Skip to content

Commit 3a8bfdd

Browse files
committed
Accept abort transaction at prepare stage
1 parent da5308c commit 3a8bfdd

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

contrib/mmts/arbiter.c

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -776,17 +776,23 @@ static void MtmTransReceiver(Datum arg)
776776
}
777777
break;
778778
case MSG_PREPARED:
779-
Assert(ts->status == TRANSACTION_STATUS_IN_PROGRESS);
780-
Assert(ts->nVotes < Mtm->nLiveNodes);
781-
if (msg->csn > ts->csn) {
782-
ts->csn = msg->csn;
783-
MtmSyncClock(ts->csn);
784-
}
785-
if (++ts->nVotes == Mtm->nLiveNodes) {
786-
ts->csn = MtmAssignCSN();
787-
ts->status = TRANSACTION_STATUS_UNKNOWN;
788-
MtmWakeUpBackend(ts);
789-
}
779+
if (ts->status != TRANSACTION_STATUS_ABORTED) {
780+
Assert(ts->status == TRANSACTION_STATUS_IN_PROGRESS);
781+
Assert(ts->nVotes < Mtm->nLiveNodes);
782+
if (msg->csn > ts->csn) {
783+
ts->csn = msg->csn;
784+
MtmSyncClock(ts->csn);
785+
}
786+
if (++ts->nVotes == Mtm->nLiveNodes) {
787+
ts->csn = MtmAssignCSN();
788+
ts->status = TRANSACTION_STATUS_UNKNOWN;
789+
MtmWakeUpBackend(ts);
790+
}
791+
} else {
792+
if (++ts->nVotes == Mtm->nLiveNodes) {
793+
MtmWakeUpBackend(ts);
794+
}
795+
}
790796
break;
791797
default:
792798
Assert(false);

contrib/mmts/multimaster.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ MtmPostPrepareTransaction(MtmCurrentTrans* x)
795795
MtmResetTransaction(x);
796796
} else {
797797
time_t transTimeout = Max(Mtm2PCMinTimeout, (ts->csn - ts->snapshot)*Mtm2PCPrepareRatio/100000); /* usec->msec and percents */
798-
time_t timeout = transTimeout < MtmHeartbeatRecvTimeout ? transTimeout : MtmHeartbeatRecvTimeout;
798+
time_t timeout = Min(transTimeout, MtmHeartbeatRecvTimeout);
799799
timestamp_t deadline = MtmGetSystemTime() + MSEC_TO_USEC(transTimeout);
800800
int result = 0;
801801
int nConfigChanges = Mtm->nConfigChanges;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy