diff options
author | Ravishankar N <ravishankar@redhat.com> | 2015-08-13 18:33:08 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2015-08-21 03:50:05 -0700 |
commit | e4cefd6c5915dd47c6b42098236df3901665f93a (patch) | |
tree | 4eb89cd041580aee0366a6bf975704473b2faafb | |
parent | aa1b166984657d53e68a2c4cbd16d2e46c12436b (diff) |
afr: launch index heal on local subvols up on a child-up event
Problem:
When a replica's child goes down and comes up, the index heal is
triggered only on the child that just came up. This does not serve the
intended purpose as the list of files that need to be healed
to this child is actually captured on the other child of the replica.
Fix:
Launch index-heal on all local children of the replica xlator which just
received a child up. Note that afr_selfheal_childup() eventually calls
afr_shd_index_healer() which will not run the heal on non-local
children.
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Change-Id: Ia23e47d197f983c695ec0bcd283e74931119ee55
BUG: 1253309
Reviewed-on: http://review.gluster.org/11912
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
-rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index de92affc6d3..99ecd734c69 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -3886,7 +3886,6 @@ afr_notify (xlator_t *this, int32_t event, int idx = -1; int ret = -1; int call_psh = 0; - int up_child = -1; dict_t *input = NULL; dict_t *output = NULL; gf_boolean_t had_quorum = _gf_false; @@ -3947,7 +3946,6 @@ afr_notify (xlator_t *this, int32_t event, priv->child_up[idx] = 1; call_psh = 1; - up_child = idx; for (i = 0; i < priv->child_count; i++) if (priv->child_up[i] == 1) up_children++; @@ -4083,22 +4081,18 @@ afr_notify (xlator_t *this, int32_t event, if (propagate) ret = default_notify (this, event, data); - if (!had_heard_from_all && have_heard_from_all && priv->shd.iamshd) { - /* - * Since self-heal is supposed to be launched only after - * the responses from all the bricks are collected, - * launch self-heals now on all up subvols. - */ - for (i = 0; i < priv->child_count; i++) - if (priv->child_up[i]) - afr_selfheal_childup (this, i); - } else if (have_heard_from_all && call_psh && priv->shd.iamshd) { - /* - * Already heard from everyone. Just launch heal on now up - * subvolume. + if ((!had_heard_from_all) || call_psh) { + /* Launch self-heal on all local subvolumes if: + * a) We have_heard_from_all for the first time + * b) Already heard from everyone, but we now got a child-up + * event. */ - afr_selfheal_childup (this, up_child); - } + if (have_heard_from_all && priv->shd.iamshd) { + for (i = 0; i < priv->child_count; i++) + if (priv->child_up[i]) + afr_selfheal_childup (this, i); + } + } out: return ret; } |