mirror of https://github.com/citusdata/citus.git
Remove two obsolete functions
Namely GetConnectionFromPGconn() and CloseConnectionByPGconn()pull/1661/head
parent
9901017f3f
commit
6736fd1682
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue