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