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

Commit 5dfe54e

Browse files
committed
Abort in-progress transaction during PollStatusOfPrepared without network communication
1 parent b0920e3 commit 5dfe54e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

multimaster.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2071,20 +2071,29 @@ MtmPollStatusOfPreparedTransactions(bool majorMode)
20712071
{
20722072
MtmTransState *ts = MtmGetActiveTransaction(cur);
20732073

2074+
// MTM_LOG1("X_MtmPollStatusOfPreparedTransactions %s, major=%d, status=%d, isPrepared=%d, valid=%d, completed=%d", ts->gid, majorMode, ts->status, ts->isPrepared, TransactionIdIsValid(ts->gtid.xid), ts->votingCompleted);
2075+
20742076
if (TransactionIdIsValid(ts->gtid.xid)
20752077
&& ts->votingCompleted /* If voting is not yet completed, then there is some backend coordinating this transaction */
20762078
&& (ts->status == TRANSACTION_STATUS_UNKNOWN || ts->status == TRANSACTION_STATUS_IN_PROGRESS))
20772079
{
20782080
Assert(ts->gid[0]);
20792081

2082+
// MTM_LOG1("MtmPollStatusOfPreparedTransactions %s, major=%d, status=%d, isPrepared=%d", ts->gid, majorMode, ts->status, ts->isPrepared);
2083+
20802084
if (majorMode)
20812085
{
20822086
MtmFinishPreparedTransaction(ts, ts->status == TRANSACTION_STATUS_UNKNOWN);
20832087
}
20842088
else
20852089
{
2086-
MTM_LOG1("Poll state of transaction %s (%llu) from node %d", ts->gid, (long64)ts->xid, ts->gtid.node);
2087-
MtmBroadcastPollMessage(ts);
2090+
// MTM_LOG1("Poll state of transaction %s (%llu) from node %d", ts->gid, (long64)ts->xid, ts->gtid.node);
2091+
// MtmBroadcastPollMessage(ts);
2092+
if (ts->gtid.node == MtmNodeId && !ts->isPrepared)
2093+
{
2094+
MTM_LOG1("Abort our in-progress transaction %s", ts->gid);
2095+
MtmFinishPreparedTransaction(ts, false);
2096+
}
20882097
}
20892098
} else {
20902099
MTM_LOG2("Skip prepared transaction %s (%d) with status %s gtid.node=%d gtid.xid=%llu votedMask=%llx",

0 commit comments

Comments
 (0)