mirror of https://github.com/citusdata/citus.git
Relax assertion on transaction rollback failure (#2052)
In case a failure happens when a transaction is rollbacked, we used to hit an assertion for ensuring there is no pending activity on the connection. However, that's not true after the changes in #2031. Thus, we've replaced the assertion with a more generic function call to consume any pending activity, if exists.pull/1997/head
parent
24659a97dc
commit
ebb8f902c8
|
@ -418,34 +418,30 @@ void
|
|||
FinishRemoteTransactionAbort(MultiConnection *connection)
|
||||
{
|
||||
RemoteTransaction *transaction = &connection->remoteTransaction;
|
||||
PGresult *result = NULL;
|
||||
const bool dontRaiseErrors = false;
|
||||
const bool isNotCommit = false;
|
||||
|
||||
result = GetRemoteCommandResult(connection, dontRaiseErrors);
|
||||
|
||||
if (!IsResponseOK(result))
|
||||
{
|
||||
ReportResultError(connection, result, WARNING);
|
||||
MarkRemoteTransactionFailed(connection, dontRaiseErrors);
|
||||
const bool raiseErrors = false;
|
||||
|
||||
if (transaction->transactionState == REMOTE_TRANS_2PC_ABORTING)
|
||||
{
|
||||
WarnAboutLeakedPreparedTransaction(connection, isNotCommit);
|
||||
}
|
||||
else
|
||||
PGresult *result = GetRemoteCommandResult(connection, raiseErrors);
|
||||
if (!IsResponseOK(result))
|
||||
{
|
||||
ereport(WARNING,
|
||||
(errmsg("failed to abort 1PC transaction \"%s\" on %s:%d",
|
||||
transaction->preparedName, connection->hostname,
|
||||
connection->port)));
|
||||
}
|
||||
const bool isCommit = false;
|
||||
WarnAboutLeakedPreparedTransaction(connection, isCommit);
|
||||
}
|
||||
|
||||
PQclear(result);
|
||||
}
|
||||
|
||||
result = GetRemoteCommandResult(connection, dontRaiseErrors);
|
||||
Assert(!result);
|
||||
/*
|
||||
* Try to consume results of any in-progress commands. In the 1PC case
|
||||
* this is also where we consume the result of the ROLLBACK.
|
||||
*
|
||||
* If we don't succeed the connection will be in a bad state, so we close it.
|
||||
*/
|
||||
if (!ClearResults(connection, raiseErrors))
|
||||
{
|
||||
ShutdownConnection(connection);
|
||||
}
|
||||
|
||||
transaction->transactionState = REMOTE_TRANS_ABORTED;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue