Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7f5318f

Browse files
knizhnikkelvich
authored andcommitted
Check for transaction status before waiting latch
1 parent 4a96cd3 commit 7f5318f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

multimaster.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,8 +800,13 @@ MtmPostPrepareTransaction(MtmCurrentTrans* x)
800800
int nConfigChanges = Mtm->nConfigChanges;
801801
/* wait votes from all nodes */
802802
while (!ts->votingCompleted) {
803-
MtmWatchdog();
804803
MtmUnlock();
804+
MtmWatchdog();
805+
if (ts->status == TRANSACTION_STATUS_ABORTED) {
806+
elog(WARNING, "Transaction %d(%s) is aborted by watchdog", x->xid, x->gid);
807+
x->status = TRANSACTION_STATUS_ABORTED;
808+
return;
809+
}
805810
result = WaitLatch(&MyProc->procLatch, WL_LATCH_SET|WL_TIMEOUT, timeout);
806811
if (result & WL_LATCH_SET) {
807812
ResetLatch(&MyProc->procLatch);

0 commit comments

Comments
 (0)