diff --git a/src/backend/distributed/connection/connection_management.c b/src/backend/distributed/connection/connection_management.c index 11a0f1640..6e7cbcfc5 100644 --- a/src/backend/distributed/connection/connection_management.c +++ b/src/backend/distributed/connection/connection_management.c @@ -268,42 +268,6 @@ FindAvailableConnection(dlist_head *connections, uint32 flags) } -/* - * Return MultiConnection associated with the libpq connection. - * - * Note that this is comparatively expensive. Should only be used for - * backward-compatibility purposes. - */ -MultiConnection * -GetConnectionFromPGconn(struct pg_conn *pqConn) -{ - HASH_SEQ_STATUS status; - ConnectionHashEntry *entry; - - hash_seq_init(&status, ConnectionHash); - while ((entry = (ConnectionHashEntry *) hash_seq_search(&status)) != 0) - { - dlist_head *connections = entry->connections; - dlist_iter iter; - - /* check connection cache for a connection that's not already in use */ - dlist_foreach(iter, connections) - { - MultiConnection *connection = - dlist_container(MultiConnection, connectionNode, iter.cur); - - if (connection->pgConn == pqConn) - { - hash_seq_term(&status); - return connection; - } - } - } - - return NULL; -} - - /* * CloseNodeConnectionsAfterTransaction sets the sessionLifespan flag of the connections * to a particular node as false. This is mainly used when a worker leaves the cluster. @@ -376,31 +340,6 @@ CloseConnection(MultiConnection *connection) } -/* - * Close a previously established connection. - * - * This function closes the MultiConnection associatated with the libpq - * connection. - * - * Note that this is comparatively expensive. Should only be used for - * backward-compatibility purposes. - */ -void -CloseConnectionByPGconn(PGconn *pqConn) -{ - MultiConnection *connection = GetConnectionFromPGconn(pqConn); - - if (connection) - { - CloseConnection(connection); - } - else - { - ereport(WARNING, (errmsg("could not find connection to close"))); - } -} - - /* * ShutdownConnection, if necessary cancels the currently running statement, * and then closes the underlying libpq connection. The MultiConnection diff --git a/src/include/distributed/connection_management.h b/src/include/distributed/connection_management.h index fa736240e..93dc9d0e5 100644 --- a/src/include/distributed/connection_management.h +++ b/src/include/distributed/connection_management.h @@ -133,10 +133,8 @@ extern MultiConnection * StartNodeUserDatabaseConnection(uint32 flags, int32 port, const char *user, const char *database); -extern MultiConnection * GetConnectionFromPGconn(struct pg_conn *pqConn); extern void CloseNodeConnectionsAfterTransaction(char *nodeName, int nodePort); extern void CloseConnection(MultiConnection *connection); -extern void CloseConnectionByPGconn(struct pg_conn *pqConn); extern void ShutdownConnection(MultiConnection *connection); /* dealing with a connection */