on shutdown, consume any response before sending shutdown packet

pull/4271/head
Nils Dijk 2020-10-23 15:57:27 +02:00
parent 8aca59fa32
commit e06cf9a822
No known key found for this signature in database
GPG Key ID: CA1177EF9434F241
1 changed files with 11 additions and 1 deletions

View File

@ -616,7 +616,17 @@ ShutdownConnection(MultiConnection *connection)
if (PQstatus(connection->pgConn) == CONNECTION_OK &&
PQtransactionStatus(connection->pgConn) == PQTRANS_ACTIVE)
{
SendCancelationRequest(connection);
bool sentCancel = SendCancelationRequest(connection);
if (sentCancel)
{
/*
* If we have sent a cancelation we need to wait and consume the response to
* make sure the cancelation is processed. In case of network delay
* cancelation might hit other backend/query. Poolers might introduce out of
* order delivery.
*/
ClearResultsDiscardWarnings(connection, false);
}
}
CitusPQFinish(connection);
}