@@ -1958,9 +1958,11 @@ void MtmHandleApplyError(void)
1958
1958
* Actually, if node is precommitted (state == UNKNOWN) at any of nodes, then is is prepared at all nodes and so can be committed.
1959
1959
* But if coordinator of transaction is crashed, we made a decision about transaction commit only if transaction is precommitted at ALL live nodes.
1960
1960
* The reason is that we want to avoid extra polling to obtain maximum CSN from all nodes to assign it to committed transaction.
1961
- * Called only from MtmDisableNode in critical section.
1961
+ * Called only from MtmDisableNode and in major mode.
1962
+ *
1963
+ * commitPrecommited is used when nnodes=2 and we are switching to major/referee mode.
1962
1964
*/
1963
- void MtmPollStatusOfPreparedTransactionsForDisabledNode (int disabledNodeId )
1965
+ void MtmPollStatusOfPreparedTransactionsForDisabledNode (int disabledNodeId , bool commitPrecommited )
1964
1966
{
1965
1967
MtmTransState * ts ;
1966
1968
for (ts = Mtm -> transListHead ;ts != NULL ;ts = ts -> next ) {
@@ -1974,8 +1976,15 @@ void MtmPollStatusOfPreparedTransactionsForDisabledNode(int disabledNodeId)
1974
1976
MTM_ELOG (LOG ,"Abort transaction %s because its coordinator is disabled and it is not prepared at node %d" ,ts -> gid ,MtmNodeId );
1975
1977
MtmFinishPreparedTransaction (ts , false);
1976
1978
}else {
1977
- MTM_LOG1 ("Poll state of transaction %s (%llu)" ,ts -> gid , (long64 )ts -> xid );
1978
- MtmBroadcastPollMessage (ts );
1979
+ if (commitPrecommited )
1980
+ {
1981
+ MtmFinishPreparedTransaction (ts , true);
1982
+ }
1983
+ else
1984
+ {
1985
+ MTM_LOG1 ("Poll state of transaction %s (%llu)" ,ts -> gid , (long64 )ts -> xid );
1986
+ MtmBroadcastPollMessage (ts );
1987
+ }
1979
1988
}
1980
1989
}else {
1981
1990
MTM_LOG2 ("Skip transaction %s (%llu) with status %s gtid.node=%d gtid.xid=%llu votedMask=%llx" ,