diff options
author | Ravishankar N <ravishankar@redhat.com> | 2017-10-03 18:41:11 +0530 |
---|---|---|
committer | Ravishankar N <ravishankar@redhat.com> | 2017-10-09 12:19:16 +0530 |
commit | 452b9124f452d6c73f72da577a98f17502b1ed2c (patch) | |
tree | ac633133b64de4384e73c5e8f2493d0be495bfd3 /xlators | |
parent | 20fa80057eb430fd72b4fa31b9b65598b8ec1265 (diff) |
glusterd : fix client io-threads option for replicate volumes
Problem:
Commit ff075a3d6f9b142911d25c27fd209838782bfff0 disabled loading
client-io-threads for replicate volumes (it was set to on by default in
commit e068c1997314046658dd502e9118dab32decf879) due to performance
issues but in doing so, inadvertently failed to load the xlator even if
the user explicitly enabled the option using the volume set command.
This was despite returning returning sucess for the volume set.
Fix:
Modify the check in perfxl_option_handler() and add checks in volume
create/add-brick/remove-brick code paths, tying it all to
GD_OP_VERSION_3_12_2.
Change-Id: Ib612973a999a7da818cc926f5c2601b1f0794fcf
BUG: 1498570
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 34 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 7 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 20 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.h | 3 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.c | 28 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 34 |
6 files changed, 92 insertions, 34 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c index fdb6014bb63..6d17ff4e32d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c @@ -1432,6 +1432,24 @@ glusterd_op_perform_add_bricks (glusterd_volinfo_t *volinfo, int32_t count, /* Gets changed only if the options are given in add-brick cli */ if (type) volinfo->type = type; + /* performance.client-io-threads is turned on by default, + * however this has adverse effects on replicate volumes due to + * replication design issues, till that get addressed + * performance.client-io-threads option is turned off for all + * replicate volumes if not already explicitly enabled. + */ + if (type && glusterd_is_volume_replicate (volinfo) && + conf->op_version >= GD_OP_VERSION_3_12_2) { + ret = dict_set_str (volinfo->dict, + "performance.client-io-threads", + "off"); + if (ret) { + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SET_FAILED, "Failed to set " + "performance.client-io-threads to off"); + goto out; + } + } if (replica_count) { volinfo->replica_count = replica_count; @@ -2713,9 +2731,12 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr) char *cold_shd_key = NULL; char *hot_shd_key = NULL; int delete_key = 1; + glusterd_conf_t *conf = NULL; this = THIS; GF_ASSERT (this); + conf = this->private; + GF_VALIDATE_OR_GOTO (this->name, conf, out); ret = dict_get_str (dict, "volname", &volname); @@ -3005,6 +3026,19 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr) volinfo->subvol_count = (volinfo->brick_count / volinfo->dist_leaf_count); + if (!glusterd_is_volume_replicate (volinfo) && + conf->op_version >= GD_OP_VERSION_3_12_2) { + ret = dict_set_str (volinfo->dict, + "performance.client-io-threads", + "on"); + if (ret) { + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SET_FAILED, "Failed to set " + "performance.client-io-threads to on"); + goto out; + } + } + ret = glusterd_create_volfiles_and_notify_services (volinfo); if (ret) { gf_msg (this->name, GF_LOG_WARNING, 0, diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 25898dbd1fb..1d55cc8a215 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -4847,7 +4847,7 @@ glusterd_get_volume_opts (rpcsvc_request_t *req, dict_t *dict) (dict, _gf_false, key, orig_key, - volinfo, + volinfo->dict, &rsp.op_errstr); if (ret && !rsp.op_errstr) { snprintf (err_str, @@ -4873,7 +4873,7 @@ glusterd_get_volume_opts (rpcsvc_request_t *req, dict_t *dict) } else { /* Handle the "all" volume option request */ ret = glusterd_get_default_val_for_volopt (dict, _gf_true, NULL, - NULL, volinfo, + NULL, volinfo->dict, &rsp.op_errstr); if (ret && !rsp.op_errstr) { snprintf (err_str, sizeof(err_str), @@ -5462,7 +5462,8 @@ glusterd_get_state (rpcsvc_request_t *req, dict_t *dict) vol_all_opts = dict_new (); ret = glusterd_get_default_val_for_volopt (vol_all_opts, - _gf_true, NULL, NULL, volinfo, &rsp.op_errstr); + _gf_true, NULL, NULL, volinfo->dict, + &rsp.op_errstr); if (ret) { gf_msg (this->name, GF_LOG_ERROR, 0, GD_MSG_VOL_OPTS_IMPORT_FAIL, "Failed to " diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index b861edf4a20..fd70516a289 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -12836,8 +12836,7 @@ out: int glusterd_get_default_val_for_volopt (dict_t *ctx, gf_boolean_t all_opts, char *input_key, char *orig_key, - glusterd_volinfo_t *volinfo, - char **op_errstr) + dict_t *vol_dict, char **op_errstr) { struct volopt_map_entry *vme = NULL; int ret = -1; @@ -12848,7 +12847,6 @@ glusterd_get_default_val_for_volopt (dict_t *ctx, gf_boolean_t all_opts, char dict_key[50] = {0,}; gf_boolean_t key_found = _gf_false; glusterd_conf_t *priv = NULL; - dict_t *vol_dict = NULL; this = THIS; GF_ASSERT (this); @@ -12856,7 +12854,6 @@ glusterd_get_default_val_for_volopt (dict_t *ctx, gf_boolean_t all_opts, priv = this->private; GF_VALIDATE_OR_GOTO (this->name, priv, out); - vol_dict = volinfo->dict; GF_VALIDATE_OR_GOTO (this->name, vol_dict, out); /* Check whether key is passed for a single option */ @@ -12878,20 +12875,6 @@ glusterd_get_default_val_for_volopt (dict_t *ctx, gf_boolean_t all_opts, if (!def_val) { ret = dict_get_str (vol_dict, vme->key, &def_val); if (!def_val) { - /* For replicate volumes - * performance.client-io-threads will be set to - * off by default until explicitly turned on - */ - if (!strcmp (vme->key, - "performance.client-io-threads")) { - if (volinfo->type == - GF_CLUSTER_TYPE_REPLICATE || - volinfo->type == - GF_CLUSTER_TYPE_STRIPE_REPLICATE) { - def_val = "off"; - goto set_count; - } - } if (vme->value) { def_val = vme->value; } else { @@ -12904,7 +12887,6 @@ glusterd_get_default_val_for_volopt (dict_t *ctx, gf_boolean_t all_opts, } } } -set_count: count++; sprintf (dict_key, "key%d", count); ret = dict_set_str(ctx, dict_key, vme->key); diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h index ce3a7787be5..65ea7565d3a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.h +++ b/xlators/mgmt/glusterd/src/glusterd-utils.h @@ -722,8 +722,7 @@ glusterd_get_global_options_for_all_vols (rpcsvc_request_t *req, dict_t *dict, int glusterd_get_default_val_for_volopt (dict_t *dict, gf_boolean_t all_opts, char *key, char *orig_key, - glusterd_volinfo_t *volinfo, - char **err_str); + dict_t *vol_dict, char **err_str); int glusterd_check_client_op_version_support (char *volname, uint32_t op_version, diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index f65ad94ace6..f3d4d08bf05 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -2671,9 +2671,15 @@ perfxl_option_handler (volgen_graph_t *graph, struct volopt_map_entry *vme, { gf_boolean_t enabled = _gf_false; glusterd_volinfo_t *volinfo = NULL; + xlator_t *this = NULL; + glusterd_conf_t *priv = NULL; - GF_ASSERT (param); + GF_VALIDATE_OR_GOTO ("glusterd", param, out); volinfo = param; + this = THIS; + GF_VALIDATE_OR_GOTO ("glusterd", this, out); + priv = this->private; + GF_VALIDATE_OR_GOTO ("glusterd", priv, out); if (strcmp (vme->option, "!perf") != 0) return 0; @@ -2689,13 +2695,15 @@ perfxl_option_handler (volgen_graph_t *graph, struct volopt_map_entry *vme, (vme->op_version > volinfo->client_op_version)) return 0; - /* For replicate volumes do not load io-threads as it affects - * performance - */ - if (!strcmp (vme->key, "performance.client-io-threads") && - (GF_CLUSTER_TYPE_STRIPE_REPLICATE == volinfo->type || - GF_CLUSTER_TYPE_REPLICATE == volinfo->type)) - return 0; + if (priv->op_version < GD_OP_VERSION_3_12_2) { + /* For replicate volumes do not load io-threads as it affects + * performance + */ + if (!strcmp (vme->key, "performance.client-io-threads") && + (GF_CLUSTER_TYPE_STRIPE_REPLICATE == volinfo->type || + GF_CLUSTER_TYPE_REPLICATE == volinfo->type)) + return 0; + } /* if VKEY_READDIR_AHEAD is enabled and parallel readdir is * not enabled then load readdir-ahead here else it will be @@ -2706,8 +2714,8 @@ perfxl_option_handler (volgen_graph_t *graph, struct volopt_map_entry *vme, if (volgen_graph_add (graph, vme->voltype, volinfo->volname)) return 0; - else - return -1; +out: + return -1; } static int diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index 23795e8ac23..a783a008b14 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -2232,6 +2232,23 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) volinfo->stripe_count = 1; if (GF_CLUSTER_TYPE_REPLICATE == volinfo->type) { + /* performance.client-io-threads is turned on to default, + * however this has adverse effects on replicate volumes due to + * replication design issues, till that get addressed + * performance.client-io-threads option is turned off for all + * replicate volumes + */ + if (priv->op_version >= GD_OP_VERSION_3_12_2) { + ret = dict_set_str (volinfo->dict, + "performance.client-io-threads", + "off"); + if (ret) { + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SET_FAILED, "Failed to set " + "performance.client-io-threads to off"); + goto out; + } + } ret = dict_get_int32 (dict, "replica-count", &volinfo->replica_count); if (ret) { @@ -2252,6 +2269,23 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr) goto out; } } else if (GF_CLUSTER_TYPE_STRIPE_REPLICATE == volinfo->type) { + /* performance.client-io-threads is turned on to default, + * however this has adverse effects on replicate volumes due to + * replication design issues, till that get addressed + * performance.client-io-threads option is turned off for all + * replicate volumes + */ + if (priv->op_version >= GD_OP_VERSION_3_12_2) { + ret = dict_set_str (volinfo->dict, + "performance.client-io-threads", + "off"); + if (ret) { + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_DICT_SET_FAILED, "Failed to set " + "performance.client-io-threads to off"); + goto out; + } + } ret = dict_get_int32 (dict, "stripe-count", &volinfo->stripe_count); if (ret) { |