Do not call CheckRemoteTransactionsHealth from commit handler

release-7.4
Marco Slot 2018-06-08 21:24:39 +02:00 committed by velioglu
parent 12a8c040ec
commit 79235c35fb
3 changed files with 12 additions and 10 deletions

View File

@ -43,7 +43,6 @@ static void StartRemoteTransactionSavepointRollback(MultiConnection *connection,
static void FinishRemoteTransactionSavepointRollback(MultiConnection *connection, static void FinishRemoteTransactionSavepointRollback(MultiConnection *connection,
SubTransactionId subId); SubTransactionId subId);
static void CheckTransactionHealth(void);
static void Assign2PCIdentifier(MultiConnection *connection); static void Assign2PCIdentifier(MultiConnection *connection);
static void WarnAboutLeakedPreparedTransaction(MultiConnection *connection, bool commit); static void WarnAboutLeakedPreparedTransaction(MultiConnection *connection, bool commit);
@ -837,12 +836,6 @@ CoordinatedRemoteTransactionsCommit(void)
List *connectionList = NIL; List *connectionList = NIL;
bool raiseInterrupts = false; bool raiseInterrupts = false;
/*
* Before starting to commit on any of the nodes - after which we can't
* completely roll-back anymore - check that things are in a good state.
*/
CheckTransactionHealth();
/* /*
* Issue appropriate transaction commands to remote nodes. If everything * Issue appropriate transaction commands to remote nodes. If everything
* went well that's going to be COMMIT or COMMIT PREPARED, if individual * went well that's going to be COMMIT or COMMIT PREPARED, if individual
@ -1229,13 +1222,13 @@ FinishRemoteTransactionSavepointRollback(MultiConnection *connection, SubTransac
/* /*
* CheckTransactionHealth checks if any of the participating transactions in a * CheckRemoteTransactionsHealth checks if any of the participating transactions in a
* coordinated transaction failed, and what consequence that should have. * coordinated transaction failed, and what consequence that should have.
* This needs to be called before the coordinated transaction commits (but * This needs to be called before the coordinated transaction commits (but
* after they've been PREPAREd if 2PC is in use). * after they've been PREPAREd if 2PC is in use).
*/ */
static void void
CheckTransactionHealth(void) CheckRemoteTransactionsHealth(void)
{ {
dlist_iter iter; dlist_iter iter;

View File

@ -283,9 +283,17 @@ CoordinatedTransactionCallback(XactEvent event, void *arg)
{ {
CoordinatedRemoteTransactionsPrepare(); CoordinatedRemoteTransactionsPrepare();
CurrentCoordinatedTransactionState = COORD_TRANS_PREPARED; CurrentCoordinatedTransactionState = COORD_TRANS_PREPARED;
/*
* Make sure we did not have any failures on connections marked as
* critical before committing.
*/
CheckRemoteTransactionsHealth();
} }
else else
{ {
CheckRemoteTransactionsHealth();
/* /*
* Have to commit remote transactions in PRE_COMMIT, to allow * Have to commit remote transactions in PRE_COMMIT, to allow
* us to mark failed placements as invalid. Better don't use * us to mark failed placements as invalid. Better don't use

View File

@ -130,6 +130,7 @@ extern void ResetRemoteTransaction(struct MultiConnection *connection);
extern void CoordinatedRemoteTransactionsPrepare(void); extern void CoordinatedRemoteTransactionsPrepare(void);
extern void CoordinatedRemoteTransactionsCommit(void); extern void CoordinatedRemoteTransactionsCommit(void);
extern void CoordinatedRemoteTransactionsAbort(void); extern void CoordinatedRemoteTransactionsAbort(void);
extern void CheckRemoteTransactionsHealth(void);
/* remote savepoint commands */ /* remote savepoint commands */
extern void CoordinatedRemoteTransactionsSavepointBegin(SubTransactionId subId); extern void CoordinatedRemoteTransactionsSavepointBegin(SubTransactionId subId);