From b392c33725a83d2c2fa07e53450f33f8cc2de238 Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Thu, 22 Sep 2016 16:48:54 +0530 Subject: cluster/afr: CLI for granular entry heal enablement/disablement When there are already existing non-granular indices created that are yet to be healed, if granular-entry-heal option is toggled from 'off' to 'on', AFR self-heal whenever it kicks in, will try to look for granular indices in 'entry-changes'. Because of the absence of name indices, granular entry healing logic will fail to heal these directories, and worse yet unset pending extended attributes with the assumption that are no entries that need heal. To get around this, a new CLI is introduced which will invoke glfsheal program to figure whether at the time an attempt is made to enable granular entry heal, there are pending heals on the volume OR there are one or more bricks that are down. If either of them is true, the command will be failed with the appropriate error. New CLI: gluster volume heal granular-entry-heal {enable,disable} Change-Id: I1f4fe8162813b9068e198965d94169fee4adc099 BUG: 1370410 Signed-off-by: Krutika Dhananjay Reviewed-on: http://review.gluster.org/15747 Smoke: Gluster Build System Reviewed-by: Pranith Kumar Karampuri NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Atin Mukherjee --- cli/src/cli-cmd-parser.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'cli/src/cli-cmd-parser.c') diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index 38054a94f5..94bda6766f 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -3821,7 +3821,8 @@ cli_cmd_volume_heal_options_parse (const char **words, int wordcount, if (wordcount == 5) { if (strcmp (words[3], "info") && - strcmp (words[3], "statistics")) { + strcmp (words[3], "statistics") && + strcmp (words[3], "granular-entry-heal")) { ret = -1; goto out; } @@ -3851,6 +3852,19 @@ cli_cmd_volume_heal_options_parse (const char **words, int wordcount, goto done; } } + + if (!strcmp (words[3], "granular-entry-heal")) { + if (!strcmp (words[4], "enable")) { + ret = dict_set_int32 (dict, "heal-op", + GF_SHD_OP_GRANULAR_ENTRY_HEAL_ENABLE); + goto done; + } else if (!strcmp (words[4], "disable")) { + ret = dict_set_int32 (dict, "heal-op", + GF_SHD_OP_GRANULAR_ENTRY_HEAL_DISABLE); + goto done; + } + } + ret = -1; goto out; } -- cgit