@@ -1958,9 +1958,11 @@ void MtmHandleApplyError(void)
19581958 * Actually, if node is precommitted (state == UNKNOWN) at any of nodes, then is is prepared at all nodes and so can be committed.
19591959 * But if coordinator of transaction is crashed, we made a decision about transaction commit only if transaction is precommitted at ALL live nodes.
19601960 * 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.
19621964 */
1963- void MtmPollStatusOfPreparedTransactionsForDisabledNode (int disabledNodeId )
1965+ void MtmPollStatusOfPreparedTransactionsForDisabledNode (int disabledNodeId , bool commitPrecommited )
19641966{
19651967MtmTransState * ts ;
19661968for (ts = Mtm -> transListHead ;ts != NULL ;ts = ts -> next ) {
@@ -1974,8 +1976,15 @@ void MtmPollStatusOfPreparedTransactionsForDisabledNode(int disabledNodeId)
19741976MTM_ELOG (LOG ,"Abort transaction %s because its coordinator is disabled and it is not prepared at node %d" ,ts -> gid ,MtmNodeId );
19751977MtmFinishPreparedTransaction (ts , false);
19761978}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+ }
19791988}
19801989}else {
19811990MTM_LOG2 ("Skip transaction %s (%llu) with status %s gtid.node=%d gtid.xid=%llu votedMask=%llx" ,