Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7cf14d5

Browse files
knizhnikkelvich
authored andcommitted
Correctly update nRunningTransactions for user's 2PC transactions
1 parent3586931 commit7cf14d5

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

‎multimaster.c‎

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,6 +1255,15 @@ Mtm2PCVoting(MtmCurrentTrans* x, MtmTransState* ts)
12551255
MTM_LOG3("%d: Result of vote: %d",MyProcPid,MtmTxnStatusMnem[ts->status]);
12561256
}
12571257

1258+
staticvoidMtmStopTransaction(void)
1259+
{
1260+
if (MtmInsideTransaction) {
1261+
Assert(Mtm->nRunningTransactions>0);
1262+
Mtm->nRunningTransactions-=1;
1263+
MtmInsideTransaction= false;
1264+
}
1265+
}
1266+
12581267
staticvoid
12591268
MtmPostPrepareTransaction(MtmCurrentTrans*x)
12601269
{
@@ -1293,13 +1302,14 @@ MtmPostPrepareTransaction(MtmCurrentTrans* x)
12931302
}else {
12941303
ts->votingCompleted= true;
12951304
}
1296-
MtmUnlock();
12971305
if (x->isTwoPhase) {
12981306
if (x->status==TRANSACTION_STATUS_ABORTED) {
12991307
MTM_ELOG(WARNING,"Prepare of user's 2PC transaction %s (%llu) is aborted by DTM",x->gid, (long64)x->xid);
1300-
}
1308+
}
1309+
MtmStopTransaction();
13011310
MtmResetTransaction();
13021311
}
1312+
MtmUnlock();
13031313
}
13041314
if (Mtm->inject2PCError==3) {
13051315
Mtm->inject2PCError=0;
@@ -1387,7 +1397,7 @@ MtmLogAbortLogicalMessage(int nodeId, char const* gid)
13871397
XLogFlush(lsn);
13881398
MTM_LOG1("MtmLogAbortLogicalMessage node=%d transaction=%s lsn=%llx",nodeId,gid,lsn);
13891399
}
1390-
1400+
13911401

13921402
staticvoid
13931403
MtmEndTransaction(MtmCurrentTrans*x,boolcommit)
@@ -1398,11 +1408,7 @@ MtmEndTransaction(MtmCurrentTrans* x, bool commit)
13981408

13991409
MtmLock(LW_EXCLUSIVE);
14001410

1401-
if (MtmInsideTransaction) {
1402-
Assert(Mtm->nRunningTransactions>0);
1403-
Mtm->nRunningTransactions-=1;
1404-
MtmInsideTransaction= false;
1405-
}
1411+
MtmStopTransaction();
14061412

14071413
if (x->isDistributed&& (x->isPrepared||x->isReplicated)&& !x->isTwoPhase) {
14081414
MtmTransState*ts=NULL;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp