@@ -78,22 +78,28 @@ static void
78
78
MtmCheckState (void )
79
79
{
80
80
// int nVotingNodes = MtmGetNumberOfVotingNodes();
81
+ bool isEnabledState ;
81
82
int nEnabled = countZeroBits (Mtm -> disabledNodeMask ,Mtm -> nAllNodes );
82
83
int nConnected = countZeroBits (SELF_CONNECTIVITY_MASK ,Mtm -> nAllNodes );
83
84
int nReceivers = Mtm -> nAllNodes - countZeroBits (Mtm -> pglogicalReceiverMask ,Mtm -> nAllNodes );
84
85
int nSenders = Mtm -> nAllNodes - countZeroBits (Mtm -> pglogicalSenderMask ,Mtm -> nAllNodes );
85
86
86
- MTM_LOG1 ("[STATE] Status = (disabled=%s, unaccessible=%s, clique=%s, receivers=%s, senders=%s, total=%i)" ,
87
+ MTM_LOG1 ("[STATE] Status = (disabled=%s, unaccessible=%s, clique=%s, receivers=%s, senders=%s, total=%i, major=%d )" ,
87
88
maskToString (Mtm -> disabledNodeMask ,Mtm -> nAllNodes ),
88
89
maskToString (SELF_CONNECTIVITY_MASK ,Mtm -> nAllNodes ),
89
90
maskToString (Mtm -> clique ,Mtm -> nAllNodes ),
90
91
maskToString (Mtm -> pglogicalReceiverMask ,Mtm -> nAllNodes ),
91
92
maskToString (Mtm -> pglogicalSenderMask ,Mtm -> nAllNodes ),
92
- Mtm -> nAllNodes );
93
+ Mtm -> nAllNodes ,
94
+ MtmMajorNode );
95
+
96
+ isEnabledState =
97
+ ( (nConnected >=Mtm -> nAllNodes /2 + 1 )/* majority */
98
+ || (nConnected == Mtm -> nAllNodes /2 && MtmMajorNode ) )/* or half + major node */
99
+ && BIT_CHECK (Mtm -> clique ,MtmNodeId - 1 );/* in clique */
93
100
94
101
/* ANY -> MTM_DISABLED */
95
- if (nConnected < Mtm -> nAllNodes /2 + 1 ||
96
- !BIT_CHECK (Mtm -> clique ,MtmNodeId - 1 ) )
102
+ if (!isEnabledState )
97
103
{
98
104
BIT_SET (Mtm -> disabledNodeMask ,MtmNodeId - 1 );
99
105
MtmSetClusterStatus (MTM_DISABLED );
@@ -103,8 +109,7 @@ MtmCheckState(void)
103
109
switch (Mtm -> status )
104
110
{
105
111
case MTM_DISABLED :
106
- if ( (nConnected >=Mtm -> nAllNodes /2 + 1 )&& /* majority */
107
- BIT_CHECK (Mtm -> clique ,MtmNodeId - 1 ) )/* in clique */
112
+ if (isEnabledState )
108
113
{
109
114
MtmSetClusterStatus (MTM_RECOVERY );
110
115
return ;
@@ -298,6 +303,7 @@ void MtmOnNodeDisconnect(int nodeId)
298
303
MtmLock (LW_EXCLUSIVE );
299
304
BIT_SET (SELF_CONNECTIVITY_MASK ,nodeId - 1 );
300
305
BIT_SET (Mtm -> reconnectMask ,nodeId - 1 );
306
+ Mtm -> nConfigChanges += 1 ;
301
307
MtmCheckState ();
302
308
MtmUnlock ();
303
309