MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / read_node

Function read_node

tests/tools/testutil.c:100–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100char *read_node(cdb2_hndl_tp *db)
101{
102 char *host;
103 int rc;
104
105 rc = cdb2_run_statement(db, "select comdb2_host()");
106 if (rc) {
107 tdprintf(stderr, db, __func__, __LINE__,
108 "run: don't know what node I'm on\n");
109 return NULL;
110 }
111 rc = cdb2_next_record(db);
112 if (rc != CDB2_OK) {
113 tdprintf(stderr, db, __func__, __LINE__,
114 "next: don't know what node I'm on\n");
115 return NULL;
116 }
117 host = cdb2_column_value(db, 0);
118 if (host) host = strdup(host);
119 while (rc == CDB2_OK) {
120 rc = cdb2_next_record(db);
121 }
122 if (rc != CDB2_OK_DONE) {
123 tdprintf(stderr, db, __func__, __LINE__, "next read node rc %d %s\n",
124 rc, cdb2_errstr(db));
125 return NULL;
126 }
127
128 return host;
129}
130
131void myexit(const char *func, int line, int status)
132{

Callers 3

thdFunction · 0.85
thdFunction · 0.85
checkFunction · 0.85

Calls 6

cdb2_run_statementFunction · 0.85
tdprintfFunction · 0.85
cdb2_next_recordFunction · 0.85
cdb2_column_valueFunction · 0.85
cdb2_errstrFunction · 0.85
strdupFunction · 0.50

Tested by

no test coverage detected