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

Function create_sql_pool

db/sqlpool.c:124–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124static struct thdpool *create_sql_pool(const char *zName, int nThreads)
125{
126 struct thdpool *pool = thdpool_create(
127 (zName != NULL) ? zName : SQL_POOL_LEGACY_NAME,
128 sizeof(struct sqlthdstate));
129
130 if (pool == NULL) return NULL;
131
132 if (!gbl_exit_on_pthread_create_fail)
133 thdpool_unset_exit(pool);
134
135 thdpool_set_stack_size(pool, SQL_POOL_STACK_SIZE);
136 thdpool_set_init_fn(pool, thdpool_sqlengine_start);
137 thdpool_set_delt_fn(pool, thdpool_sqlengine_end);
138 thdpool_set_dque_fn(pool, thdpool_sqlengine_dque);
139 thdpool_set_queued_callback(pool, clnt_queued_event);
140
141 if (zName != NULL) {
142 /* TODO: *TUNING* Defaults for non-default pools. */
143 thdpool_set_maxthds(pool, nThreads);
144 thdpool_set_maxqueueoverride(pool, SQL_POOL_NAMED_MAXQ_OVERRIDE);
145 } else {
146 thdpool_set_minthds(pool, SQL_POOL_DEFLT_MIN_THREADS);
147 thdpool_set_maxthds(pool, SQL_POOL_DEFLT_MAX_THREADS);
148 thdpool_set_linger(pool, SQL_POOL_LINGER_SECS);
149 thdpool_set_maxqueueoverride(pool, SQL_POOL_DEFLT_MAXQ_OVERRIDE);
150 thdpool_set_maxqueueagems(pool, SQL_POOL_MAXQ_AGE_MS);
151 thdpool_set_dump_on_full(pool, 1);
152 }
153
154 return pool;
155}
156
157/*
158** WARNING: The "try_add_sql_pool" function assumes the hash lock is already

Callers 2

get_default_sql_poolFunction · 0.85
get_named_sql_poolFunction · 0.85

Calls 13

thdpool_createFunction · 0.85
thdpool_unset_exitFunction · 0.85
thdpool_set_stack_sizeFunction · 0.85
thdpool_set_init_fnFunction · 0.85
thdpool_set_delt_fnFunction · 0.85
thdpool_set_dque_fnFunction · 0.85
thdpool_set_maxthdsFunction · 0.85
thdpool_set_minthdsFunction · 0.85
thdpool_set_lingerFunction · 0.85

Tested by

no test coverage detected