MCPcopy Create free account
hub / github.com/apache/cloudberry / GetStorageServerExtended

Function GetStorageServerExtended

src/backend/commands/storagecmds.c:69–107  ·  view source on GitHub ↗

* GetStorageServerExtended - look up the storage server definition. If * flags uses FSV_MISSING_OK, return NULL if the object cannot be found * instead of raising an error. */

Source from the content-addressed store, hash-verified

67 * instead of raising an error.
68 */
69StorageServer *
70GetStorageServerExtended(Oid serverid, bits16 flags)
71{
72 Form_gp_storage_server serverform;
73 StorageServer *server;
74 HeapTuple tp;
75 Datum datum;
76 bool isnull;
77
78 tp = SearchSysCache1(STORAGESERVEROID, ObjectIdGetDatum(serverid));
79
80 if (!HeapTupleIsValid(tp))
81 {
82 if ((flags & SSV_MISSING_OK) == 0)
83 elog(ERROR, "cache lookup failed for storage server %u", serverid);
84 return NULL;
85 }
86
87 serverform = (Form_gp_storage_server) GETSTRUCT(tp);
88
89 server = (StorageServer *) palloc(sizeof(StorageServer));
90 server->serverid = serverid;
91 server->servername = pstrdup(NameStr(serverform->srvname));
92 server->owner = serverform->srvowner;
93
94 /* Extract the srvoptions */
95 datum = SysCacheGetAttr(STORAGESERVEROID,
96 tp,
97 Anum_gp_storage_server_srvoptions,
98 &isnull);
99 if (isnull)
100 server->options = NIL;
101 else
102 server->options = untransformRelOptions(datum);
103
104 ReleaseSysCache(tp);
105
106 return server;
107}
108
109/*
110 * GetStorageServer - look up the storage server definition.

Callers 3

GetStorageServerFunction · 0.85
getObjectDescriptionFunction · 0.85
getObjectIdentityPartsFunction · 0.85

Calls 7

SearchSysCache1Function · 0.85
ObjectIdGetDatumFunction · 0.85
SysCacheGetAttrFunction · 0.85
untransformRelOptionsFunction · 0.85
ReleaseSysCacheFunction · 0.85
pallocFunction · 0.50
pstrdupFunction · 0.50

Tested by

no test coverage detected