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

Commit 61a5266

Browse files
committed
extra safety belt agains working in minority
1 parent 34f55fa commit 61a5266

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

state.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,20 @@ MtmCheckState(void)
213213
break;
214214

215215
case MTM_ONLINE:
216+
{
217+
int nEnabled = countZeroBits(Mtm->disabledNodeMask, Mtm->nAllNodes);
218+
// Assert( (nEnabled >= Mtm->nAllNodes/2+1) ||
219+
// (nEnabled == Mtm->nAllNodes/2 && Mtm->refereeGrant));
220+
if ( !((nEnabled >= Mtm->nAllNodes/2+1) ||
221+
(nEnabled == Mtm->nAllNodes/2 && Mtm->refereeGrant)) )
222+
{
223+
MTM_LOG1("[STATE] disable myself, nEnabled less then majority");
224+
MtmSetClusterStatus(MTM_DISABLED, statusReason);
225+
MtmDisableNode(MtmNodeId);
226+
/* do not recur */
227+
return;
228+
}
229+
}
216230
break;
217231
}
218232

0 commit comments

Comments
 (0)