@@ -801,7 +801,7 @@ MtmPrePrepareTransaction(MtmCurrentTrans* x)
801
801
timestamp_t now = MtmGetSystemTime ();
802
802
if (Mtm -> lastClusterStatusUpdate + MSEC_TO_USEC (MtmHeartbeatRecvTimeout ) < now ) {
803
803
Mtm -> lastClusterStatusUpdate = now ;
804
- MtmRefreshClusterStatus (true);
804
+ MtmRefreshClusterStatus (true, 0 );
805
805
}
806
806
if (!IsBackgroundWorker && Mtm -> status != MTM_ONLINE ) {
807
807
/* Do not take in account bg-workers which are performing recovery */
@@ -1461,9 +1461,9 @@ MtmBuildConnectivityMatrix(nodemask_t* matrix, bool nowait)
1461
1461
* Build connectivity graph, find clique in it and extend disabledNodeMask by nodes not included in clique.
1462
1462
* This function returns false if current node is excluded from cluster, true otherwise
1463
1463
*/
1464
- bool MtmRefreshClusterStatus (bool nowait )
1464
+ bool MtmRefreshClusterStatus (bool nowait , int testNodeId )
1465
1465
{
1466
- nodemask_t mask , clique , disabled ;
1466
+ nodemask_t mask , clique , disabled , enabled ;
1467
1467
nodemask_t matrix [MAX_NODES ];
1468
1468
MtmTransState * ts ;
1469
1469
int clique_size ;
@@ -1496,17 +1496,13 @@ bool MtmRefreshClusterStatus(bool nowait)
1496
1496
MtmDisableNode (i + 1 );
1497
1497
}
1498
1498
}
1499
- #if 0 /* Do not enable nodes here: them will be enabled after completion of recovery */
1500
1499
enabled = clique & Mtm -> disabledNodeMask ; /* new enabled nodes mask */
1501
- for (i = 0 , mask = enabled ; mask != 0 ; i ++ , mask >>= 1 ) {
1502
- if (mask & 1 ) {
1503
- MtmEnableNode (i + 1 );
1504
- }
1500
+ if (testNodeId != 0 && BIT_CHECK (enabled , testNodeId - 1 )) {
1501
+ MtmEnableNode (testNodeId );
1505
1502
}
1506
- Mtm -> reconnectMask |= clique & Mtm -> disabledNodeMask ; /* new enabled nodes mask */
1507
- #endif
1503
+ // Mtm->reconnectMask |= clique & Mtm->disabledNodeMask; /* new enabled nodes mask */
1508
1504
1509
- if (disabled ) {
1505
+ if (disabled | enabled ) {
1510
1506
MtmCheckQuorum ();
1511
1507
}
1512
1508
/* Interrupt voting for active transaction and abort them */
@@ -1622,7 +1618,7 @@ void MtmOnNodeDisconnect(int nodeId)
1622
1618
}
1623
1619
MtmUnlock ();
1624
1620
} else {
1625
- MtmRefreshClusterStatus (false);
1621
+ MtmRefreshClusterStatus (false, 0 );
1626
1622
}
1627
1623
}
1628
1624
@@ -2595,7 +2591,7 @@ MtmReplicationStartupHook(struct PGLogicalStartupHookArgs* args)
2595
2591
MtmCheckQuorum ();
2596
2592
} else {
2597
2593
MtmUnlock ();
2598
- MtmRefreshClusterStatus (true);
2594
+ MtmRefreshClusterStatus (true, MtmReplicationNodeId );
2599
2595
MtmLock (LW_SHARED );
2600
2596
if (BIT_CHECK (Mtm -> disabledNodeMask , MtmReplicationNodeId - 1 )) {
2601
2597
MtmUnlock ();
0 commit comments