cman: Don't increment on LEAVING->MEMBER transition
PATCH 1/1 cman: Don't increment on LEAVING->MEMBER transition
If a node left the cluster prior using 'cman_tool leave', its internal state is set to NODESTATE_LEAVING.
Ordinarily, during the transition from NODESTATE_LEAVING to NODESTATE_DEAD, the member count is decremented. However, it is possible to rejoin the cluster membership from the NODESTATE_LEAVING state.
If this occurs, the cluster member count is incremented, but since the node never transitioned from LEAVING->DEAD, it was not previously decremented, causing an ever-increasing node count in 'cman_tool status'.
This patch resolves the issue by not incrementing the member count during a LEAVING->MEMBER transition.
Resolves: rhbz#649533
--- cman/daemon/commands.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
cman/daemon/commands.c +4 -1
@@ -1994,9 +1994,12 @@ void add_ais_node(int nodeid, uint64_t incarnation, int total_members)if (node->state ==NODESTATE_DEAD || node->state ==NODESTATE_LEAVING ) {gettimeofday (&node->join_time,NULL ); +/* If a node rejoins before it completes a leave, +* we should not increment cluster_members */ +if (node->state !=NODESTATE_LEAVING ) + cluster_members++; node->incarnation = incarnation; node->state =NODESTATE_MEMBER ; - cluster_members++;recalculate_quorum (0 ,0 ); } }
Signature · 1 line
1.7.2.3
PATCH 1/1 cman: Don't increment on LEAVING->MEMBER transition
The patch looks sane to me and I am fairly sure it needs to be applied to STABLE31/RHEL6 too.
I?d like also an ACK from Chrissie here.
Fabio
Quoted 41 lines · Lon Hohberger
If a node left the cluster prior using '
cman_toolleave', its internal state is set toNODESTATE_LEAVING.Ordinarily, during the transition from
NODESTATE_LEAVINGtoNODESTATE_DEAD, the member count is decremented. However, it is possible to rejoin the cluster membership from theNODESTATE_LEAVINGstate.If this occurs, the cluster member count is incremented, but since the node never transitioned from
LEAVING->DEAD, it was not previously decremented, causing an ever-increasing node count in 'cman_toolstatus'.This patch resolves the issue by not incrementing the member count during a
LEAVING->MEMBERtransition.Resolves: rhbz#649533
Signed-off-by Lon Hohberger <[email protected]>--- cman/daemon/commands.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)cman/daemon/commands.c +4
-1@@ -1994,9 +1994,12 @@ void add_ais_node(int nodeid, uint64_t incarnation, int total_members)if (node->state ==NODESTATE_DEAD || node->state ==NODESTATE_LEAVING ) {gettimeofday (&node->join_time,NULL ); +/* If a node rejoins before it completes a leave, +* we should not increment cluster_members */ +if (node->state !=NODESTATE_LEAVING ) + cluster_members++; node->incarnation = incarnation; node->state =NODESTATE_MEMBER ; - cluster_members++;recalculate_quorum (0 ,0 ); } }
PATCH 1/1 cman: Don't increment on LEAVING->MEMBER transition
Quoted 4 lines · Fabio M. Di Nitto
The patch looks sane to me and I am fairly sure it needs to be applied to STABLE31/RHEL6 too.
I?d like also an ACK from Chrissie here.
ACK
Chrissie
Quoted 45 lines
Fabio
Quoted 41 lines · Lon Hohberger
If a node left the cluster prior using '
cman_toolleave', its internal state is set toNODESTATE_LEAVING.Ordinarily, during the transition from
NODESTATE_LEAVINGtoNODESTATE_DEAD, the member count is decremented. However, it is possible to rejoin the cluster membership from theNODESTATE_LEAVINGstate.If this occurs, the cluster member count is incremented, but since the node never transitioned from
LEAVING->DEAD, it was not previously decremented, causing an ever-increasing node count in 'cman_toolstatus'.This patch resolves the issue by not incrementing the member count during a
LEAVING->MEMBERtransition.Resolves: rhbz#649533
Signed-off-by Lon Hohberger<[email protected]>--- cman/daemon/commands.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)cman/daemon/commands.c +4
-1@@ -1994,9 +1994,12 @@ void add_ais_node(int nodeid, uint64_t incarnation, int total_members)if (node->state ==NODESTATE_DEAD || node->state ==NODESTATE_LEAVING ) {gettimeofday (&node->join_time,NULL ); +/* If a node rejoins before it completes a leave, +* we should not increment cluster_members */ +if (node->state !=NODESTATE_LEAVING ) + cluster_members++; node->incarnation = incarnation; node->state =NODESTATE_MEMBER ; - cluster_members++;recalculate_quorum (0 ,0 ); } }