@@ -736,9 +736,13 @@ MtmPrePrepareTransaction(MtmCurrentTrans* x)
736
736
Assert (TransactionIdIsValid (x -> xid ));
737
737
738
738
if (Mtm -> disabledNodeMask != 0 ) {
739
- MtmRefreshClusterStatus (true);
739
+ timestamp_t now = MtmGetSystemTime ();
740
+ if (Mtm -> lastClusterStatusUpdate + MSEC_TO_USEC (MtmRaftPollDelay ) < now ) {
741
+ Mtm -> lastClusterStatusUpdate = now ;
742
+ MtmRefreshClusterStatus (true);
743
+ }
740
744
if (!IsBackgroundWorker && Mtm -> status != MTM_ONLINE ) {
741
- /* Do not take in accoutn bg-workers which are performing recovery */
745
+ /* Do not take in account bg-workers which are performing recovery */
742
746
elog (ERROR , "Abort current transaction because this cluster node is in %s status" , MtmNodeStatusMnem [Mtm -> status ]);
743
747
}
744
748
}
@@ -834,8 +838,10 @@ MtmPostPrepareTransaction(MtmCurrentTrans* x)
834
838
time_t transTimeout = Max (Mtm2PCMinTimeout , (ts -> csn - ts -> snapshot )* Mtm2PCPrepareRatio /100000 ); /* usec->msec and percents */
835
839
int result = 0 ;
836
840
int nConfigChanges = Mtm -> nConfigChanges ;
841
+
842
+ timestamp_t start = MtmGetSystemTime ();
837
843
/* wait votes from all nodes */
838
- while (!ts -> votingCompleted && !( result & WL_TIMEOUT ))
844
+ while (!ts -> votingCompleted && start + transTimeout >= MtmGetSystemTime ( ))
839
845
{
840
846
MtmUnlock ();
841
847
MtmWatchdog ();
@@ -844,7 +850,7 @@ MtmPostPrepareTransaction(MtmCurrentTrans* x)
844
850
x -> status = TRANSACTION_STATUS_ABORTED ;
845
851
return ;
846
852
}
847
- result = WaitLatch (& MyProc -> procLatch , WL_LATCH_SET |WL_TIMEOUT , transTimeout );
853
+ result = WaitLatch (& MyProc -> procLatch , WL_LATCH_SET |WL_TIMEOUT , MtmHeartbeatRecvTimeout );
848
854
if (result & WL_LATCH_SET ) {
849
855
ResetLatch (& MyProc -> procLatch );
850
856
}
@@ -1568,6 +1574,7 @@ static void MtmInitialize()
1568
1574
Mtm -> recoverySlot = 0 ;
1569
1575
Mtm -> locks = GetNamedLWLockTranche (MULTIMASTER_NAME );
1570
1576
Mtm -> csn = MtmGetCurrentTime ();
1577
+ Mtm -> lastClusterStatusUpdate = MtmGetSystemTime ();
1571
1578
Mtm -> lastCsn = INVALID_CSN ;
1572
1579
Mtm -> oldestXid = FirstNormalTransactionId ;
1573
1580
Mtm -> nLiveNodes = MtmNodes ;
0 commit comments