Merge pull request #2772 from citusdata/cancel

Use SendCancelationRequest() in ShutdownConnection()
pull/2757/head
Hadi Moshayedi 2019-06-18 12:16:40 +02:00 committed by GitHub
commit 04abc1137f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 9 deletions

View File

@ -456,15 +456,7 @@ ShutdownConnection(MultiConnection *connection)
if (PQstatus(connection->pgConn) == CONNECTION_OK &&
PQtransactionStatus(connection->pgConn) == PQTRANS_ACTIVE)
{
char errorMessage[ERROR_BUFFER_SIZE] = { 0 };
PGcancel *cancel = PQgetCancel(connection->pgConn);
if (!PQcancel(cancel, errorMessage, sizeof(errorMessage)))
{
ereport(WARNING, (errmsg("could not cancel connection: %s",
errorMessage)));
}
PQfreeCancel(cancel);
SendCancelationRequest(connection);
}
PQfinish(connection->pgConn);
connection->pgConn = NULL;