mirror of https://github.com/citusdata/citus.git
Merge pull request #2772 from citusdata/cancel
Use SendCancelationRequest() in ShutdownConnection()pull/2757/head
commit
04abc1137f
|
@ -456,15 +456,7 @@ ShutdownConnection(MultiConnection *connection)
|
||||||
if (PQstatus(connection->pgConn) == CONNECTION_OK &&
|
if (PQstatus(connection->pgConn) == CONNECTION_OK &&
|
||||||
PQtransactionStatus(connection->pgConn) == PQTRANS_ACTIVE)
|
PQtransactionStatus(connection->pgConn) == PQTRANS_ACTIVE)
|
||||||
{
|
{
|
||||||
char errorMessage[ERROR_BUFFER_SIZE] = { 0 };
|
SendCancelationRequest(connection);
|
||||||
PGcancel *cancel = PQgetCancel(connection->pgConn);
|
|
||||||
|
|
||||||
if (!PQcancel(cancel, errorMessage, sizeof(errorMessage)))
|
|
||||||
{
|
|
||||||
ereport(WARNING, (errmsg("could not cancel connection: %s",
|
|
||||||
errorMessage)));
|
|
||||||
}
|
|
||||||
PQfreeCancel(cancel);
|
|
||||||
}
|
}
|
||||||
PQfinish(connection->pgConn);
|
PQfinish(connection->pgConn);
|
||||||
connection->pgConn = NULL;
|
connection->pgConn = NULL;
|
||||||
|
|
Loading…
Reference in New Issue