From dff1a8bd5bcd392826561c93058f8a52606a2832 Mon Sep 17 00:00:00 2001 From: Kaushik BV Date: Mon, 11 Apr 2011 08:38:40 +0000 Subject: mgmt/Glusterd: Do not disable marker on gsync stop. Signed-off-by: Kaushik BV Signed-off-by: Anand Avati BUG: 2559 (provide two options in CLI for gluster volume gsync indexing ) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2559 --- xlators/mgmt/glusterd/src/glusterd-op-sm.c | 60 +++++++++++++++--------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'xlators/mgmt/glusterd/src') diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index f86de9256..644c607ac 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -3910,11 +3910,14 @@ out: } int -glusterd_set_marker_gsync (char *master, char *value) +glusterd_set_marker_gsync (char *master) { char *volname = NULL; glusterd_volinfo_t *volinfo = NULL; int ret = -1; + char *marker_value = NULL; + gf_boolean_t marker_set = _gf_false; + char *gsync_status = NULL; volname = volname_from_master (master); @@ -3924,16 +3927,34 @@ glusterd_set_marker_gsync (char *master, char *value) ret = -1; goto out; } - - ret = glusterd_gsync_volinfo_dict_set (volinfo, - "features.marker-gsync", value); - if (ret < 0) + ret = glusterd_volinfo_get (volinfo, "features.marker-gsync", &marker_value); + if (ret) { + gf_log ("", GF_LOG_ERROR, "failed to get the marker status"); + ret = -1; goto out; + } - ret = glusterd_marker_create_volfile (volinfo); - if (ret) { - gf_log ("", GF_LOG_ERROR, "Setting dict failed"); + ret = gf_string2boolean (marker_value, &marker_set); + if (ret != 0) goto out; + + if (marker_set == _gf_false) { + gsync_status = gf_strdup ("on"); + if (gsync_status == NULL) { + ret = -1; + goto out; + } + + ret = glusterd_gsync_volinfo_dict_set (volinfo, + "features.marker-gsync", gsync_status); + if (ret < 0) + goto out; + + ret = glusterd_marker_create_volfile (volinfo); + if (ret) { + gf_log ("", GF_LOG_ERROR, "Setting dict failed"); + goto out; + } } out: @@ -3948,7 +3969,6 @@ glusterd_op_gsync_set (dict_t *dict) int32_t ret = -1; int32_t type = -1; dict_t *ctx = NULL; - char *gsync_status = NULL; char *op_errstr = NULL; ret = dict_get_int32 (dict, "type", &type); @@ -3960,13 +3980,8 @@ glusterd_op_gsync_set (dict_t *dict) goto out; if (type == GF_GSYNC_OPTION_TYPE_START) { - gsync_status = gf_strdup ("on"); - if (gsync_status == NULL) { - ret = -1; - goto out; - } - ret = glusterd_set_marker_gsync (master, gsync_status); + ret = glusterd_set_marker_gsync (master); if (ret != 0) { gf_log ("", GF_LOG_WARNING, "marker start failed"); op_errstr = gf_strdup ("gsync start failed"); @@ -3975,21 +3990,6 @@ glusterd_op_gsync_set (dict_t *dict) } } - if (type == GF_GSYNC_OPTION_TYPE_STOP) { - gsync_status = gf_strdup ("off"); - if (gsync_status == NULL) { - ret = -1; - goto out; - } - - ret = glusterd_set_marker_gsync (master, gsync_status); - if (ret != 0) { - gf_log ("", GF_LOG_WARNING, "marker stop failed"); - op_errstr = gf_strdup ("gsync stop failed"); - ret = -1; - goto out; - } - } out: ctx = glusterd_op_get_ctx (GD_OP_GSYNC_SET); if (ctx) { -- cgit