@@ -737,9 +737,13 @@ MtmPrePrepareTransaction(MtmCurrentTrans* x)
737737 Assert (TransactionIdIsValid (x -> xid ));
738738
739739 if (Mtm -> disabledNodeMask != 0 ) {
740- MtmRefreshClusterStatus (true);
740+ timestamp_t now = MtmGetSystemTime ();
741+ if (Mtm -> lastClusterStatusUpdate + MSEC_TO_USEC (MtmRaftPollDelay ) < now ) {
742+ Mtm -> lastClusterStatusUpdate = now ;
743+ MtmRefreshClusterStatus (true);
744+ }
741745 if (!IsBackgroundWorker && Mtm -> status != MTM_ONLINE ) {
742- /* Do not take in accoutn bg-workers which are performing recovery */
746+ /* Do not take in account bg-workers which are performing recovery */
743747 elog (ERROR , "Abort current transaction because this cluster node is in %s status" , MtmNodeStatusMnem [Mtm -> status ]);
744748 }
745749 }
@@ -835,8 +839,10 @@ MtmPostPrepareTransaction(MtmCurrentTrans* x)
835839 time_t transTimeout = Max (Mtm2PCMinTimeout , (ts -> csn - ts -> snapshot )* Mtm2PCPrepareRatio /100000 ); /* usec->msec and percents */
836840 int result = 0 ;
837841 int nConfigChanges = Mtm -> nConfigChanges ;
842+
843+ timestamp_t start = MtmGetSystemTime ();
838844 /* wait votes from all nodes */
839- while (!ts -> votingCompleted && !( result & WL_TIMEOUT ))
845+ while (!ts -> votingCompleted && start + transTimeout >= MtmGetSystemTime ( ))
840846 {
841847 MtmUnlock ();
842848 MtmWatchdog ();
@@ -845,7 +851,7 @@ MtmPostPrepareTransaction(MtmCurrentTrans* x)
845851 x -> status = TRANSACTION_STATUS_ABORTED ;
846852 return ;
847853 }
848- result = WaitLatch (& MyProc -> procLatch , WL_LATCH_SET |WL_TIMEOUT , transTimeout );
854+ result = WaitLatch (& MyProc -> procLatch , WL_LATCH_SET |WL_TIMEOUT , MtmHeartbeatRecvTimeout );
849855 if (result & WL_LATCH_SET ) {
850856 ResetLatch (& MyProc -> procLatch );
851857 }
@@ -1569,6 +1575,7 @@ static void MtmInitialize()
15691575 Mtm -> recoverySlot = 0 ;
15701576 Mtm -> locks = GetNamedLWLockTranche (MULTIMASTER_NAME );
15711577 Mtm -> csn = MtmGetCurrentTime ();
1578+ Mtm -> lastClusterStatusUpdate = MtmGetSystemTime ();
15721579 Mtm -> lastCsn = INVALID_CSN ;
15731580 Mtm -> oldestXid = FirstNormalTransactionId ;
15741581 Mtm -> nLiveNodes = MtmNodes ;
0 commit comments