Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ec97513

Browse files
committed
Revert "Clean up MtmCheckState"
This reverts commit bc2f052.
1 parent e176384 commit ec97513

File tree

1 file changed

+18
-21
lines changed

1 file changed

+18
-21
lines changed

state.c

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,18 @@ MtmSetClusterStatus(MtmNodeStatus status, char *statusReason)
108108
static void
109109
MtmCheckState(void)
110110
{
111+
// int nVotingNodes = MtmGetNumberOfVotingNodes();
111112
bool isEnabledState;
112113
char *statusReason = "node is disabled by default";
113114
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);
115119

116120
old_status = Mtm->status;
117121

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)",
120123
maskToString(Mtm->disabledNodeMask, Mtm->nAllNodes),
121124
maskToString(SELF_CONNECTIVITY_MASK, Mtm->nAllNodes),
122125
maskToString(Mtm->clique, Mtm->nAllNodes),
@@ -189,26 +192,20 @@ MtmCheckState(void)
189192
* in MTM_RECOVERED state.
190193
*/
191194
case MTM_RECOVERED:
195+
if (nReceivers == nEnabled-1 && nSenders == nEnabled-1 && nEnabled == nConnected)
192196
{
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);
196205

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;
212209
}
213210
break;
214211

0 commit comments

Comments
 (0)