@@ -1349,6 +1349,7 @@ void MtmRecoveryCompleted(void)
1349
1349
MtmLock (LW_EXCLUSIVE );
1350
1350
Mtm -> recoverySlot = 0 ;
1351
1351
BIT_CLEAR (Mtm -> disabledNodeMask , MtmNodeId - 1 );
1352
+ Mtm -> reconnectMask |= Mtm -> connectivityMask ; /* try to reestablish all connections */
1352
1353
Mtm -> nodes [MtmNodeId - 1 ].lastStatusChangeTime = MtmGetSystemTime ();
1353
1354
for (i = 0 ; i < Mtm -> nAllNodes ; i ++ ) {
1354
1355
Mtm -> nodes [i ].lastHeartbeat = 0 ; /* defuse watchdog until first heartbeat is received */
@@ -1469,6 +1470,7 @@ bool MtmRecoveryCaughtUp(int nodeId, XLogRecPtr slotLSN)
1469
1470
void MtmSwitchClusterMode (MtmNodeStatus mode )
1470
1471
{
1471
1472
Mtm -> status = mode ;
1473
+ Mtm -> nodes [MtmNodeId - 1 ].lastStatusChangeTime = MtmGetSystemTime ();
1472
1474
MTM_LOG1 ("Switch to %s mode" , MtmNodeStatusMnem [mode ]);
1473
1475
/* ??? Something else to do here? */
1474
1476
}
@@ -1603,11 +1605,10 @@ bool MtmRefreshClusterStatus(bool nowait, int testNodeId)
1603
1605
if (disabled ) {
1604
1606
timestamp_t now = MtmGetSystemTime ();
1605
1607
for (i = 0 , mask = disabled ; mask != 0 ; i ++ , mask >>= 1 ) {
1606
- if (i + 1 != MtmNodeId
1607
- && (mask & 1 ) != 0
1608
- && Mtm -> nodes [i ].lastStatusChangeTime + MSEC_TO_USEC (MtmNodeDisableDelay ) < now )
1609
- {
1610
- MtmDisableNode (i + 1 );
1608
+ if (mask & 1 ) {
1609
+ if (Mtm -> nodes [i ].lastStatusChangeTime + MSEC_TO_USEC (MtmNodeDisableDelay ) < now ) {
1610
+ MtmDisableNode (i + 1 );
1611
+ }
1611
1612
}
1612
1613
}
1613
1614
}
@@ -1682,6 +1683,7 @@ void MtmOnNodeDisconnect(int nodeId)
1682
1683
MtmLock (LW_EXCLUSIVE );
1683
1684
BIT_SET (Mtm -> connectivityMask , nodeId - 1 );
1684
1685
BIT_SET (Mtm -> reconnectMask , nodeId - 1 );
1686
+ MTM_LOG1 ("Disconnect node %d connectivity mask %lx" , nodeId , Mtm -> connectivityMask );
1685
1687
MtmUnlock ();
1686
1688
1687
1689
if (!RaftableSet (psprintf ("node-mask-%d" , MtmNodeId ), & Mtm -> connectivityMask , sizeof Mtm -> connectivityMask , false))
@@ -1726,7 +1728,7 @@ void MtmOnNodeConnect(int nodeId)
1726
1728
BIT_CLEAR (Mtm -> reconnectMask , nodeId - 1 );
1727
1729
MtmUnlock ();
1728
1730
1729
- MTM_LOG1 ("Reconnect node %d" , nodeId );
1731
+ MTM_LOG1 ("Reconnect node %d, connectivityMask=%lx " , nodeId , Mtm -> connectivityMask );
1730
1732
RaftableSet (psprintf ("node-mask-%d" , MtmNodeId ), & Mtm -> connectivityMask , sizeof Mtm -> connectivityMask , false);
1731
1733
}
1732
1734
0 commit comments