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