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

Function list_all_sql_pools_func

db/sqlpool.c:264–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262}
263
264static int list_all_sql_pools_func(void *obj, void *arg)
265{
266 pool_entry_t *entry = (pool_entry_t *)obj;
267 if (entry == NULL) return 0;
268 struct thdpool *pool = entry->pPool;
269 pool_foreach_data_t *data = (pool_foreach_data_t *)arg;
270 SBUF2 *sb = (data != NULL) ? data->sb : NULL;
271 if (sb != NULL) {
272 /* NOTE: Being called from comdb2_save_ruleset(), use SBUF. */
273 /* NOTE: Also, skip emitting the "default" SQL engine pool. */
274 if ((entry->zName != NULL) &&
275 (pool != get_default_sql_pool(0))) {
276 sbuf2printf(sb, "pool %s", entry->zName);
277 if (entry->nThreads != 0) {
278 sbuf2printf(sb, " threads %lld", entry->nThreads);
279 }
280 sbuf2printf(sb, "\n");
281 data->sum++;
282 }
283 } else {
284 /* NOTE: Being called from process_command(), use logmsg. */
285 logmsg(LOGMSG_USER,
286 "%s: (name {%s}, threads %lld) ==> (name {%s}, threads %d)\n",
287 __func__, (entry->zName != NULL) ? entry->zName : "<null>",
288 entry->nThreads,
289 (pool != NULL) ? thdpool_get_name(pool) : "<null>",
290 (pool != NULL) ? thdpool_get_maxthds(pool) : -1);
291 data->sum++;
292 }
293 return 0;
294}
295
296int list_all_sql_pools(SBUF2 *sb)
297{

Callers

nothing calls this directly

Calls 4

get_default_sql_poolFunction · 0.85
thdpool_get_nameFunction · 0.85
thdpool_get_maxthdsFunction · 0.85
logmsgFunction · 0.50

Tested by

no test coverage detected