Do not call CheckRemoteTransactionsHealth from commit handler

pull/2215/head
Marco Slot 2018-06-08 21:24:39 +02:00
parent bc1cc419e1
commit 0feb1f2eb1
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,
SubTransactionId subId);
static void CheckTransactionHealth(void);
static void Assign2PCIdentifier(MultiConnection *connection);
static void WarnAboutLeakedPreparedTransaction(MultiConnection *connection, bool commit);
@ -837,12 +836,6 @@ CoordinatedRemoteTransactionsCommit(void)
List *connectionList = NIL;
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
* 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.
* This needs to be called before the coordinated transaction commits (but
* after they've been PREPAREd if 2PC is in use).
*/
static void
CheckTransactionHealth(void)
void
CheckRemoteTransactionsHealth(void)
{
dlist_iter iter;

View File

@ -315,9 +315,17 @@ CoordinatedTransactionCallback(XactEvent event, void *arg)
{
CoordinatedRemoteTransactionsPrepare();
CurrentCoordinatedTransactionState = COORD_TRANS_PREPARED;
/*
* Make sure we did not have any failures on connections marked as
* critical before committing.
*/
CheckRemoteTransactionsHealth();
}
else
{
CheckRemoteTransactionsHealth();
/*
* Have to commit remote transactions in PRE_COMMIT, to allow
* 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 CoordinatedRemoteTransactionsCommit(void);
extern void CoordinatedRemoteTransactionsAbort(void);
extern void CheckRemoteTransactionsHealth(void);
/* remote savepoint commands */
extern void CoordinatedRemoteTransactionsSavepointBegin(SubTransactionId subId);