mirror of https://github.com/citusdata/citus.git
Defer pool start to first session
parent
3961f4517b
commit
75fb6556b5
|
@ -1946,9 +1946,6 @@ FindOrCreateWorkerPool(DistributedExecution *execution, char *nodeName, int node
|
||||||
workerPool->nodeName = pstrdup(nodeName);
|
workerPool->nodeName = pstrdup(nodeName);
|
||||||
workerPool->nodePort = nodePort;
|
workerPool->nodePort = nodePort;
|
||||||
|
|
||||||
INSTR_TIME_SET_ZERO(workerPool->poolStartTime);
|
|
||||||
workerPool->distributedExecution = execution;
|
|
||||||
|
|
||||||
/* "open" connections aggressively when there are cached connections */
|
/* "open" connections aggressively when there are cached connections */
|
||||||
int nodeConnectionCount = MaxCachedConnectionsPerWorker;
|
int nodeConnectionCount = MaxCachedConnectionsPerWorker;
|
||||||
workerPool->maxNewConnectionsPerCycle = Max(1, nodeConnectionCount);
|
workerPool->maxNewConnectionsPerCycle = Max(1, nodeConnectionCount);
|
||||||
|
@ -2422,6 +2419,18 @@ ManageWorkerPool(WorkerPool *workerPool)
|
||||||
*/
|
*/
|
||||||
connection->claimedExclusively = true;
|
connection->claimedExclusively = true;
|
||||||
|
|
||||||
|
if (list_length(workerPool->sessionList) == 0)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* The worker pool has just started to establish connections. We need to
|
||||||
|
* defer this initilization after StartNodeUserDatabaseConnection()
|
||||||
|
* because for non-optional connections, we have some logic to wait
|
||||||
|
* until a connection is allowed to be established for a duration of
|
||||||
|
* citus.connection_retry_timeout.
|
||||||
|
*/
|
||||||
|
INSTR_TIME_SET_ZERO(workerPool->poolStartTime);
|
||||||
|
}
|
||||||
|
|
||||||
/* create a session for the connection */
|
/* create a session for the connection */
|
||||||
WorkerSession *session = FindOrCreateWorkerSession(workerPool, connection);
|
WorkerSession *session = FindOrCreateWorkerSession(workerPool, connection);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue