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

Commit 7c42a86

Browse files
committed
Handle PREPARE message for aborted transactions at slaves
1 parent c00a592 commit 7c42a86

File tree

2 files changed

+11
-24
lines changed

2 files changed

+11
-24
lines changed

contrib/mmts/arbiter.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -904,11 +904,15 @@ static void MtmTransReceiver(Datum arg)
904904
} else {
905905
switch (msg->code) {
906906
case MSG_PREPARE:
907-
Assert(ts->status == TRANSACTION_STATUS_IN_PROGRESS);
908-
ts->status = TRANSACTION_STATUS_UNKNOWN;
909-
ts->csn = MtmAssignCSN();
910-
MtmAdjustSubtransactions(ts);
911-
MtmSendNotificationMessage(ts, MSG_PREPARED);
907+
if (ts->status == TRANSACTION_STATUS_IN_PROGRESS) {
908+
ts->status = TRANSACTION_STATUS_UNKNOWN;
909+
ts->csn = MtmAssignCSN();
910+
MtmAdjustSubtransactions(ts);
911+
MtmSendNotificationMessage(ts, MSG_PREPARED);
912+
} else {
913+
Assert(ts->status == TRANSACTION_STATUS_ABORTED);
914+
MtmSendNotificationMessage(ts, MSG_ABORTED);
915+
}
912916
break;
913917
default:
914918
Assert(false);

contrib/mmts/multimaster.c

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ int MtmReplicationNodeId;
196196
int MtmArbiterPort;
197197
int MtmConnectTimeout;
198198
int MtmReconnectTimeout;
199-
int MtmRaftPollDelay;
200199
int MtmNodeDisableDelay;
201200
int MtmTransSpillThreshold;
202201
int MtmMaxNodes;
@@ -737,7 +736,7 @@ MtmPrePrepareTransaction(MtmCurrentTrans* x)
737736

738737
if (Mtm->disabledNodeMask != 0) {
739738
timestamp_t now = MtmGetSystemTime();
740-
if (Mtm->lastClusterStatusUpdate + MSEC_TO_USEC(MtmRaftPollDelay) < now) {
739+
if (Mtm->lastClusterStatusUpdate + MSEC_TO_USEC(MtmHeartbeatRecvTimeout) < now) {
741740
Mtm->lastClusterStatusUpdate = now;
742741
MtmRefreshClusterStatus(true);
743742
}
@@ -1439,7 +1438,7 @@ void MtmOnNodeDisconnect(int nodeId)
14391438

14401439
RaftableSet(psprintf("node-mask-%d", MtmNodeId), &Mtm->connectivityMask, sizeof Mtm->connectivityMask, true); /* false); -- TODO: raftable is hanged with nowait=true */
14411440

1442-
MtmSleep(MSEC_TO_USEC(MtmRaftPollDelay));
1441+
MtmSleep(MSEC_TO_USEC(MtmHeartbeatSendTimeout));
14431442

14441443
if (!MtmUseRaftable)
14451444
{
@@ -2060,22 +2059,6 @@ _PG_init(void)
20602059
NULL
20612060
);
20622061

2063-
DefineCustomIntVariable(
2064-
"multimaster.raft_poll_delay",
2065-
"Multimaster delay of polling cluster state from Raftable after updating local node status",
2066-
"Timeout in milliseconds before polling state of nodes",
2067-
&MtmRaftPollDelay,
2068-
1000,
2069-
1,
2070-
INT_MAX,
2071-
PGC_BACKEND,
2072-
0,
2073-
NULL,
2074-
NULL,
2075-
NULL
2076-
);
2077-
2078-
20792062
MtmSplitConnStrs();
20802063
MtmStartReceivers();
20812064

0 commit comments

Comments
 (0)