* 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. */
| 67 | * instead of raising an error. |
| 68 | */ |
| 69 | StorageServer * |
| 70 | GetStorageServerExtended(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. |
no test coverage detected