summaryrefslogtreecommitdiffstats
path: root/cli/src/cli-cmd-parser.c
diff options
context:
space:
mode:
authorShwetha K Acharya <sacharya@redhat.com>2019-07-31 11:34:19 +0530
committerAravinda VK <mail@aravindavk.in>2020-01-03 15:34:34 +0000
commit59ed165a60a58db62a67a9d9fbe75d8338e5ddeb (patch)
tree2cd575d0d00b32cd1d23634c97538eed086e931e /cli/src/cli-cmd-parser.c
parent1e56e7acc3ced4f49d4494556bf6c86cd017b4ea (diff)
geo-rep: Note section is required for ignore_deletes
There exists a window of 15 sec, where the deletes are picked up by history crawl when the ignore_deletes is set to true. And it eventually deletes the file/s from slave which is/are not supposed to be deleted. Though it is working as per design, a note regarding this is needed. Added a warning message indicating the same. Also logged info when the worker restarts after ignore-deletes option set. fixes: bz#1708603 Change-Id: I103be882fac18b4cef935efa355f5037a396f7c1 Signed-off-by: Shwetha K Acharya <sacharya@redhat.com>
Diffstat (limited to 'cli/src/cli-cmd-parser.c')
-rw-r--r--cli/src/cli-cmd-parser.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 4d65d4de871..aeac4c7c697 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -2861,8 +2861,8 @@ out:
}
int32_t
-cli_cmd_gsync_set_parse(const char **words, int wordcount, dict_t **options,
- char **errstr)
+cli_cmd_gsync_set_parse(struct cli_state *state, const char **words,
+ int wordcount, dict_t **options, char **errstr)
{
int32_t ret = -1;
dict_t *dict = NULL;
@@ -2880,6 +2880,8 @@ cli_cmd_gsync_set_parse(const char **words, int wordcount, dict_t **options,
char *save_ptr = NULL;
char *slave_temp = NULL;
char *token = NULL;
+ gf_answer_t answer = GF_ANSWER_NO;
+ const char *question = NULL;
GF_ASSERT(words);
GF_ASSERT(options);
@@ -3066,16 +3068,36 @@ cli_cmd_gsync_set_parse(const char **words, int wordcount, dict_t **options,
}
if (!ret)
ret = dict_set_int32(dict, "type", type);
- if (!ret && type == GF_GSYNC_OPTION_TYPE_CONFIG)
+ if (!ret && type == GF_GSYNC_OPTION_TYPE_CONFIG) {
+ if (!strcmp((char *)words[wordcount - 2], "ignore-deletes") &&
+ !strcmp((char *)words[wordcount - 1], "true")) {
+ question =
+ "There exists ~15 seconds delay for the option to take"
+ " effect from stime of the corresponding brick. Please"
+ " check the log for the time, the option is effective."
+ " Proceed";
+
+ answer = cli_cmd_get_confirmation(state, question);
+
+ if (GF_ANSWER_NO == answer) {
+ gf_log("cli", GF_LOG_INFO,
+ "Operation "
+ "cancelled, exiting");
+ *errstr = gf_strdup("Aborted by user.");
+ ret = -1;
+ goto out;
+ }
+ }
+
ret = config_parse(words, wordcount, dict, cmdi, glob);
+ }
out:
if (slave_temp)
GF_FREE(slave_temp);
- if (ret) {
- if (dict)
- dict_unref(dict);
- } else
+ if (ret && dict)
+ dict_unref(dict);
+ else
*options = dict;
return ret;