diff --git a/src/backend/distributed/connection/connection_management.c b/src/backend/distributed/connection/connection_management.c index 0e9ddd7c1..df9717aa2 100644 --- a/src/backend/distributed/connection/connection_management.c +++ b/src/backend/distributed/connection/connection_management.c @@ -333,7 +333,6 @@ StartNodeUserDatabaseConnection(uint32 flags, const char *hostname, int32 port, connection = StartConnectionEstablishment(&key); dlist_push_tail(entry->connections, &connection->connectionNode); - entry->connectionCount++; ResetShardPlacementAssociation(connection); @@ -1065,8 +1064,6 @@ AfterXactHostConnectionHandling(ConnectionHashEntry *entry, bool isCommit) cachedConnectionCount++; } } - - entry->connectionCount = cachedConnectionCount; } @@ -1172,29 +1169,3 @@ TrimLogLevel(const char *message) return chompedMessage + n; } - - -/* - * NodeConnectionCount gets the number of connections to the given node - * for the current username and database. - */ -int -NodeConnectionCount(char *hostname, int port) -{ - ConnectionHashKey key; - ConnectionHashEntry *entry = NULL; - bool found = false; - - strlcpy(key.hostname, hostname, MAX_NODE_LENGTH); - key.port = port; - strlcpy(key.user, CurrentUserName(), NAMEDATALEN); - strlcpy(key.database, CurrentDatabaseName(), NAMEDATALEN); - - entry = (ConnectionHashEntry *) hash_search(ConnectionHash, &key, HASH_FIND, &found); - if (!found) - { - return 0; - } - - return entry->connectionCount; -} diff --git a/src/backend/distributed/executor/adaptive_executor.c b/src/backend/distributed/executor/adaptive_executor.c index f7b9eabf7..815de8cc6 100644 --- a/src/backend/distributed/executor/adaptive_executor.c +++ b/src/backend/distributed/executor/adaptive_executor.c @@ -1472,8 +1472,7 @@ FindOrCreateWorkerPool(DistributedExecution *execution, WorkerNode *workerNode) workerPool->distributedExecution = execution; /* "open" connections aggressively when there are cached connections */ - nodeConnectionCount = NodeConnectionCount(workerNode->workerName, - workerNode->workerPort); + nodeConnectionCount = MaxCachedConnectionsPerWorker; workerPool->maxNewConnectionsPerCycle = Max(1, nodeConnectionCount); dlist_init(&workerPool->pendingTaskQueue); diff --git a/src/include/distributed/connection_management.h b/src/include/distributed/connection_management.h index d7396067e..27d7f8b32 100644 --- a/src/include/distributed/connection_management.h +++ b/src/include/distributed/connection_management.h @@ -128,7 +128,6 @@ typedef struct ConnectionHashEntry { ConnectionHashKey key; dlist_head *connections; - int connectionCount; } ConnectionHashEntry; /* hash entry for cached connection parameters */ @@ -191,7 +190,6 @@ extern MultiConnection * StartNodeUserDatabaseConnection(uint32 flags, extern void CloseNodeConnectionsAfterTransaction(char *nodeName, int nodePort); extern void CloseConnection(MultiConnection *connection); extern void ShutdownConnection(MultiConnection *connection); -extern int NodeConnectionCount(char *nodeName, int nodePort); /* dealing with a connection */ extern void FinishConnectionListEstablishment(List *multiConnectionList);