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