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

Commit aee5bf8

Browse files
committed
recheck nConfigChanges after Mtm2PCVoting -- prevent race that lead to different decisions oabout tx on different nodes
1 parent 5f9977b commit aee5bf8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

multimaster.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,15 @@ MtmPostPrepareTransaction(MtmCurrentTrans* x)
13641364
} else {
13651365
if (!ts->isLocal) {
13661366
Mtm2PCVoting(x, ts);
1367+
1368+
/* recheck under lock that nothing is changed */
1369+
if (ts->nConfigChanges != Mtm->nConfigChanges)
1370+
{
1371+
MTM_ELOG(WARNING, "XX Abort transaction %s (%llu) because cluster configuration is changed from %d to %d (old mask %llx) since transaction start",
1372+
ts->gid, (long64)ts->xid, ts->nConfigChanges, Mtm->nConfigChanges, ts->participantsMask);
1373+
MtmAbortTransaction(ts);
1374+
x->status = TRANSACTION_STATUS_ABORTED;
1375+
}
13671376
} else {
13681377
ts->status = TRANSACTION_STATUS_UNKNOWN;
13691378
ts->votingCompleted = true;
@@ -1437,6 +1446,15 @@ MtmPreCommitPreparedTransaction(MtmCurrentTrans* x)
14371446
MtmLock(LW_EXCLUSIVE);
14381447

14391448
Mtm2PCVoting(x, ts);
1449+
1450+
/* recheck under lock that nothing is changed */
1451+
if (ts->nConfigChanges != Mtm->nConfigChanges)
1452+
{
1453+
MTM_ELOG(WARNING, "X Abort transaction %s (%llu) because cluster configuration is changed from %d to %d (old mask %llx) since transaction start",
1454+
ts->gid, (long64)ts->xid, ts->nConfigChanges, Mtm->nConfigChanges, ts->participantsMask);
1455+
MtmAbortTransaction(ts);
1456+
x->status = TRANSACTION_STATUS_ABORTED;
1457+
}
14401458
} else {
14411459
ts->status = TRANSACTION_STATUS_UNKNOWN;
14421460
}

0 commit comments

Comments
 (0)