@@ -108,15 +108,18 @@ MtmSetClusterStatus(MtmNodeStatus status, char *statusReason)
108
108
static void
109
109
MtmCheckState (void )
110
110
{
111
+ // int nVotingNodes = MtmGetNumberOfVotingNodes();
111
112
bool isEnabledState ;
112
113
char * statusReason = "node is disabled by default" ;
113
114
MtmNodeStatus old_status ;
114
- int nConnected = countZeroBits (EFFECTIVE_CONNECTIVITY_MASK , Mtm -> nAllNodes );
115
+ int nEnabled = countZeroBits (Mtm -> disabledNodeMask , Mtm -> nAllNodes );
116
+ int nConnected = countZeroBits (SELF_CONNECTIVITY_MASK , Mtm -> nAllNodes );
117
+ int nReceivers = Mtm -> nAllNodes - countZeroBits (Mtm -> pglogicalReceiverMask , Mtm -> nAllNodes );
118
+ int nSenders = Mtm -> nAllNodes - countZeroBits (Mtm -> pglogicalSenderMask , Mtm -> nAllNodes );
115
119
116
120
old_status = Mtm -> status ;
117
121
118
- MTM_LOG1 ("[STATE] %s: (disabled=%s, unaccessible=%s, clique=%s, receivers=%s, senders=%s, total=%i, major=%d, stopped=%s)" ,
119
- MtmNodeStatusMnem [Mtm -> status ],
122
+ MTM_LOG1 ("[STATE] Status = (disabled=%s, unaccessible=%s, clique=%s, receivers=%s, senders=%s, total=%i, major=%d, stopped=%s)" ,
120
123
maskToString (Mtm -> disabledNodeMask , Mtm -> nAllNodes ),
121
124
maskToString (SELF_CONNECTIVITY_MASK , Mtm -> nAllNodes ),
122
125
maskToString (Mtm -> clique , Mtm -> nAllNodes ),
@@ -189,26 +192,20 @@ MtmCheckState(void)
189
192
* in MTM_RECOVERED state.
190
193
*/
191
194
case MTM_RECOVERED :
195
+ if (nReceivers == nEnabled - 1 && nSenders == nEnabled - 1 && nEnabled == nConnected )
192
196
{
193
- int nEnabled = countZeroBits (Mtm -> disabledNodeMask , Mtm -> nAllNodes );
194
- int nReceivers = Mtm -> nAllNodes - countZeroBits (Mtm -> pglogicalReceiverMask , Mtm -> nAllNodes );
195
- int nSenders = Mtm -> nAllNodes - countZeroBits (Mtm -> pglogicalSenderMask , Mtm -> nAllNodes );
197
+ /*
198
+ * It should be already cleaned by RECOVERY_CAUGHTUP, but
199
+ * in major mode or with referee we can be working alone
200
+ * so nobody will clean it.
201
+ */
202
+ MTM_LOG1 ("[LOCK] release lock on MTM_RECOVERED switch" );
203
+ BIT_CLEAR (Mtm -> originLockNodeMask , MtmNodeId - 1 );
204
+ MtmSetClusterStatus (MTM_ONLINE , statusReason );
196
205
197
- if (nReceivers == nEnabled - 1 && nSenders == nEnabled - 1 && nEnabled == nConnected )
198
- {
199
- /*
200
- * It should be already cleaned by RECOVERY_CAUGHTUP, but
201
- * in major mode or with referee we can be working alone
202
- * so nobody will clean it.
203
- */
204
- MTM_LOG1 ("[LOCK] release lock on MTM_RECOVERED switch" );
205
- BIT_CLEAR (Mtm -> originLockNodeMask , MtmNodeId - 1 );
206
- MtmSetClusterStatus (MTM_ONLINE , statusReason );
207
-
208
- if (old_status != Mtm -> status )
209
- MtmCheckState ();
210
- return ;
211
- }
206
+ if (old_status != Mtm -> status )
207
+ MtmCheckState ();
208
+ return ;
212
209
}
213
210
break ;
214
211
0 commit comments