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

Commitcc03eac

Browse files
knizhnikkelvich
authored andcommitted
Accurartly decrement Mtm->nActiveTransactions
1 parent51a4c4a commitcc03eac

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

‎arbiter.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,10 @@ static void MtmSendHeartbeat()
341341
{
342342
if (sockets[i] >=0&&sockets[i]!=busy_socket&& !BIT_CHECK(Mtm->disabledNodeMask|Mtm->reconnectMask,i))
343343
{
344-
intrc=send(sockets[i],&msg,sizeof(msg),0);
345-
Assert(rc <=0|| (size_t)rc==sizeof(msg));
344+
size_trc=send(sockets[i],&msg,sizeof(msg),0);
345+
if ((size_t)rc!=sizeof(msg)) {
346+
elog(LOG,"Failed to send heartbeat to node %d: %d",i,errno);
347+
}
346348
}
347349
}
348350

‎multimaster.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -857,10 +857,10 @@ MtmPostPrepareTransaction(MtmCurrentTrans* x)
857857
MtmLock(LW_SHARED);
858858
}
859859
if (!ts->votingCompleted) {
860-
ts->status=TRANSACTION_STATUS_ABORTED;
860+
MtmAbortTransaction(ts);
861861
elog(WARNING,"Transaction is aborted because of %d msec timeout expiration, prepare time %d msec", (int)transTimeout, (int)USEC_TO_MSEC(ts->csn-x->snapshot));
862862
}elseif (nConfigChanges!=Mtm->nConfigChanges) {
863-
ts->status=TRANSACTION_STATUS_ABORTED;
863+
MtmAbortTransaction(ts);
864864
elog(WARNING,"Transaction is aborted because cluster configuration is changed during commit");
865865
}
866866
x->status=ts->status;
@@ -917,12 +917,12 @@ MtmEndTransaction(MtmCurrentTrans* x, bool commit)
917917
}
918918
Mtm->lastCsn=ts->csn;
919919
ts->status=TRANSACTION_STATUS_COMMITTED;
920+
MtmAdjustSubtransactions(ts);
921+
Assert(Mtm->nActiveTransactions!=0);
922+
Mtm->nActiveTransactions-=1;
920923
}else {
921-
ts->status=TRANSACTION_STATUS_ABORTED;
924+
MtmAbortTransaction(ts);
922925
}
923-
MtmAdjustSubtransactions(ts);
924-
Assert(Mtm->nActiveTransactions!=0);
925-
Mtm->nActiveTransactions-=1;
926926
}
927927
if (!commit&&x->isReplicated&&TransactionIdIsValid(x->gtid.xid)) {
928928
Assert(Mtm->status!=MTM_RECOVERY);
@@ -1066,9 +1066,11 @@ void MtmWakeUpBackend(MtmTransState* ts)
10661066

10671067
voidMtmAbortTransaction(MtmTransState*ts)
10681068
{
1069-
ts->status=TRANSACTION_STATUS_ABORTED;
1070-
MtmAdjustSubtransactions(ts);
1071-
Mtm->nActiveTransactions-=1;
1069+
if (ts->status!=TRANSACTION_STATUS_ABORTED) {
1070+
ts->status=TRANSACTION_STATUS_ABORTED;
1071+
MtmAdjustSubtransactions(ts);
1072+
Mtm->nActiveTransactions-=1;
1073+
}
10721074
}
10731075

10741076
/*
@@ -1342,8 +1344,8 @@ bool MtmRefreshClusterStatus(bool nowait)
13421344
{
13431345
nodemask_tmask,clique;
13441346
nodemask_tmatrix[MAX_NODES];
1345-
intclique_size;
13461347
MtmTransState*ts;
1348+
intclique_size;
13471349
inti;
13481350

13491351
if (!MtmUseRaftable|| !MtmBuildConnectivityMatrix(matrix,nowait)) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp