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

Commit 4902415

Browse files
committed
re-apply 98e6b043f in slightly different form
1 parent 91c853e commit 4902415

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

multimaster.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2018,7 +2018,8 @@ void MtmPollStatusOfPreparedTransactionsForDisabledNode(int disabledNodeId, bool
20182018
* This function is called before start of recovery to prevent blocking of recovery process by some
20192019
* prepared transaction which is not recovered
20202020
*/
2021-
static void MtmPollStatusOfPreparedTransactions()
2021+
void
2022+
MtmPollStatusOfPreparedTransactions(bool majorMode)
20222023
{
20232024
MtmTransState *ts;
20242025
for (ts = Mtm->transListHead; ts != NULL; ts = ts->next) {
@@ -2027,8 +2028,16 @@ static void MtmPollStatusOfPreparedTransactions()
20272028
&& (ts->status == TRANSACTION_STATUS_UNKNOWN || ts->status == TRANSACTION_STATUS_IN_PROGRESS))
20282029
{
20292030
Assert(ts->gid[0]);
2030-
MTM_LOG1("Poll state of transaction %s (%llu) from node %d", ts->gid, (long64)ts->xid, ts->gtid.node);
2031-
MtmBroadcastPollMessage(ts);
2031+
2032+
if (majorMode)
2033+
{
2034+
MtmFinishPreparedTransaction(ts, ts->status != TRANSACTION_STATUS_IN_PROGRESS);
2035+
}
2036+
else
2037+
{
2038+
MTM_LOG1("Poll state of transaction %s (%llu) from node %d", ts->gid, (long64)ts->xid, ts->gtid.node);
2039+
MtmBroadcastPollMessage(ts);
2040+
}
20322041
} else {
20332042
MTM_LOG2("Skip prepared transaction %s (%d) with status %s gtid.node=%d gtid.xid=%llu votedMask=%llx",
20342043
ts->gid, (long64)ts->xid, MtmTxnStatusMnem[ts->status], ts->gtid.node, (long64)ts->gtid.xid, ts->votedMask);
@@ -3420,7 +3429,7 @@ MtmReplicationMode MtmGetReplicationMode(int nodeId, sig_atomic_t volatile* shut
34203429
{
34213430
/* Lock on us */
34223431
Mtm->recoverySlot = nodeId;
3423-
MtmPollStatusOfPreparedTransactions();
3432+
MtmPollStatusOfPreparedTransactions(false);
34243433
MtmUnlock();
34253434
return REPLMODE_RECOVERY;
34263435
}

multimaster.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ extern void MtmInitMessage(MtmArbiterMessage* msg, MtmMessageCode code);
456456
extern void MtmSetSnapshot(csn_t snapshot);
457457
extern void MtmRefereeInitialize(void);
458458
extern void MtmPollStatusOfPreparedTransactionsForDisabledNode(int disabledNodeId, bool commitPrecommited);
459+
extern void MtmPollStatusOfPreparedTransactions(bool majorMode);
459460
extern int MtmGetNumberOfVotingNodes(void);
460461
extern void MtmToggleDML(void);
461462

state.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,10 +466,7 @@ MtmRefreshClusterStatus()
466466
Mtm->refereeGrant = true;
467467
if (countZeroBits(SELF_CONNECTIVITY_MASK, Mtm->nAllNodes) == 1)
468468
{
469-
// XXXX: that is valid for two nodes. Better idea is to parametrize MtmPollStatus*
470-
// functions.
471-
int neighbor_node_id = MtmNodeId == 1 ? 2 : 1;
472-
MtmPollStatusOfPreparedTransactionsForDisabledNode(neighbor_node_id, true);
469+
MtmPollStatusOfPreparedTransactions(true);
473470
}
474471
MtmEnableNode(MtmNodeId);
475472
MtmCheckState();

0 commit comments

Comments
 (0)