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

Commit d65f166

Browse files
committed
Fix premature PRECOMMITTED response by apply worker
1 parent 7bea7be commit d65f166

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

multimaster.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,8 +1203,6 @@ void MtmPrecommitTransaction(char const* gid)
12031203
ts->status = TRANSACTION_STATUS_UNKNOWN;
12041204
ts->csn = MtmAssignCSN();
12051205
MtmAdjustSubtransactions(ts);
1206-
if (Mtm->status != MTM_RECOVERY) // XXXX why?
1207-
MtmSend2PCMessage(ts, MSG_PRECOMMITTED);
12081206
MtmUnlock();
12091207
Assert(replorigin_session_origin != InvalidRepOriginId);
12101208
if (!IsTransactionState()) {
@@ -1215,6 +1213,11 @@ void MtmPrecommitTransaction(char const* gid)
12151213
} else {
12161214
SetPreparedTransactionState(ts->gid, MULTIMASTER_PRECOMMITTED);
12171215
}
1216+
/*
1217+
* We should send MSG_PRECOMMITTED only after SetPreparedTransactionState()
1218+
*/
1219+
if (Mtm->status != MTM_RECOVERY)
1220+
MtmSend2PCMessage(ts, MSG_PRECOMMITTED);
12181221
} else {
12191222
MTM_ELOG(WARNING, "MtmPrecommitTransaction: transaction '%s' is already in %s state", gid, MtmTxnStatusMnem[ts->status]);
12201223
MtmUnlock();

0 commit comments

Comments
 (0)