summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2014-01-07 15:54:14 +0530
committerVijay Bellur <vbellur@redhat.com>2014-01-08 09:25:06 -0800
commit88816bf4b2933da8fa2717cb0e25c521895da4e1 (patch)
treedc873171035944f0858d38a7857ad77395d9f5fa /xlators/cluster
parentc0767852b3dfad94546a5458bcf4460797cdbf0b (diff)
cluster/afr: Stop index crawl on pending full crawl
Full crawl is executed when index self-heal is useless, like disk replacement. So if there are on-going index crawls, they should be stopped inorder to start full self-heals. Change-Id: I9a1545f1ec4ad9999dc08523ce859e4fa152e214 BUG: 1049355 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/6659 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Ravishankar N <ravishankar@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r--xlators/cluster/afr/src/afr-self-heald.c40
1 files changed, 35 insertions, 5 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c
index dfa91d78501..5f85c3047d4 100644
--- a/xlators/cluster/afr/src/afr-self-heald.c
+++ b/xlators/cluster/afr/src/afr-self-heald.c
@@ -20,7 +20,8 @@
#include "event-history.h"
typedef enum {
- STOP_CRAWL_ON_SINGLE_SUBVOL = 1
+ STOP_CRAWL_ON_SINGLE_SUBVOL = 1,
+ STOP_INDEX_CRAWL_ON_PENDING_FULL_CRAWL = 2
} afr_crawl_flags_t;
typedef enum {
@@ -668,11 +669,26 @@ afr_crawl_done (int ret, call_frame_t *sync_frame, void *data)
return 0;
}
+int
+_get_heal_op_flags (shd_crawl_op op, afr_crawl_type_t crawl)
+{
+ int crawl_flags = 0;
+
+ if (HEAL == op) {
+ crawl_flags |= STOP_CRAWL_ON_SINGLE_SUBVOL;
+
+ if (crawl == INDEX)
+ crawl_flags |= STOP_INDEX_CRAWL_ON_PENDING_FULL_CRAWL;
+ }
+
+ return crawl_flags;
+}
+
void
_do_self_heal_on_subvol (xlator_t *this, int child, afr_crawl_type_t crawl)
{
afr_start_crawl (this, child, crawl, _self_heal_entry,
- NULL, _gf_true, STOP_CRAWL_ON_SINGLE_SUBVOL,
+ NULL, _gf_true, _get_heal_op_flags (HEAL, crawl),
afr_crawl_done);
}
@@ -691,6 +707,7 @@ _crawl_proceed (xlator_t *this, int child, int crawl_flags, char **reason)
gf_log (this->name, GF_LOG_DEBUG, "%s", msg);
goto out;
}
+
if (!priv->child_up[child]) {
gf_log (this->name, GF_LOG_DEBUG, "Stopping crawl for %s , "
"subvol went down", priv->children[child]->name);
@@ -707,6 +724,17 @@ _crawl_proceed (xlator_t *this, int child, int crawl_flags, char **reason)
goto out;
}
}
+
+ if (crawl_flags & STOP_INDEX_CRAWL_ON_PENDING_FULL_CRAWL) {
+ if (shd->pending[child] == FULL) {
+ gf_log (this->name, GF_LOG_INFO, "Stopping index "
+ "self-heal as Full self-heal is pending on %s",
+ priv->children[child]->name);
+ msg = "Full crawl is pending";
+ goto out;
+ }
+ }
+
proceed = _gf_true;
out:
if (reason)
@@ -730,8 +758,7 @@ _do_crawl_op_on_local_subvols (xlator_t *this, afr_crawl_type_t crawl,
int crawl_flags = 0;
priv = this->private;
- if (op == HEAL)
- crawl_flags |= STOP_CRAWL_ON_SINGLE_SUBVOL;
+ crawl_flags = _get_heal_op_flags (op, crawl);
if (output) {
ret = dict_get_int32 (output, this->name, &xl_id);
@@ -1684,7 +1711,10 @@ afr_dir_exclusive_crawl (void *data)
if (!crawl) {
gf_log (this->name, GF_LOG_INFO, "Another crawl is in progress "
- "for %s", priv->children[child]->name);
+ "for %s while attempting %s heal on %s",
+ priv->children[child]->name,
+ get_crawl_type_in_string (crawl_data->crawl),
+ priv->children[child]->name);
goto out;
}