mirror of https://github.com/citusdata/citus.git
Merge e06cf9a822
into 4cd8bb1b67
commit
d259685550
|
@ -792,7 +792,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);
|
||||
}
|
||||
|
|
|
@ -1178,6 +1178,12 @@ SendCancelationRequest(MultiConnection *connection)
|
|||
{
|
||||
char errorBuffer[ERROR_BUFFER_SIZE] = { 0 };
|
||||
|
||||
if (!PQisBusy(connection->pgConn))
|
||||
{
|
||||
/* no statement in progress, nothing to cancel */
|
||||
return false;
|
||||
}
|
||||
|
||||
PGcancel *cancelObject = PQgetCancel(connection->pgConn);
|
||||
if (cancelObject == NULL)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue