From eb04dab9992f8f5d4b2d45e1ca10032fededcff1 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Tue, 29 Apr 2014 05:49:21 +0530 Subject: cluster/afr: Fix bugs in quorum implementation - Have common place to perform quorum fop wind check - Check if fop succeeded in a way that matches quorum to avoid marking changelog in split-brain. BUG: 1066996 Change-Id: Ibc5b80e01dc206b2abbea2d29e26f3c60ff4f204 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/7600 Tested-by: Gluster Build System Reviewed-by: Ravishankar N --- xlators/cluster/afr/src/afr-common.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'xlators/cluster/afr/src/afr-common.c') diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 164a651bad5..4c7692bd671 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -3144,6 +3144,8 @@ afr_notify (xlator_t *this, int32_t event, int up_child = -1; dict_t *input = NULL; dict_t *output = NULL; + gf_boolean_t had_quorum = _gf_false; + gf_boolean_t has_quorum = _gf_false; priv = this->private; @@ -3181,6 +3183,8 @@ afr_notify (xlator_t *this, int32_t event, goto out; } + had_quorum = priv->quorum_count && afr_has_quorum (priv->child_up, + this); switch (event) { case GF_EVENT_CHILD_UP: LOCK (&priv->lock); @@ -3279,6 +3283,16 @@ afr_notify (xlator_t *this, int32_t event, break; } + if (priv->quorum_count) { + has_quorum = afr_has_quorum (priv->child_up, this); + if (!had_quorum && has_quorum) + gf_log (this->name, GF_LOG_INFO, "Client-quorum" + " is met"); + if (had_quorum && !has_quorum) + gf_log (this->name, GF_LOG_WARNING, + "Client-quorum is not met"); + } + /* have all subvolumes reported status once by now? */ have_heard_from_all = 1; for (i = 0; i < priv->child_count; i++) { -- cgit