From 733139551322e49e7e5617356cf96e30780d2749 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Wed, 3 Oct 2018 15:30:10 +0530 Subject: stripe: remove the translator from build and glusterd Based on the proposal to remove few features as they are not actively maintained [1], removing stripe translator from the build. Also make sure there are no regression tests involving stripe translator. [1] https://lists.gluster.org/pipermail/gluster-users/2018-July/034400.html Note that this patch aims at removing the translator from build, and a followup patch is needed to remove the code from repository. Updates: bz#1364707 Change-Id: I235b305338f138e29e9f30cba65bc0dadbebbbd5 Signed-off-by: Amar Tumballi --- xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 190 +----------------------- xlators/mgmt/glusterd/src/glusterd-store.c | 11 -- xlators/mgmt/glusterd/src/glusterd-tier.c | 4 - xlators/mgmt/glusterd/src/glusterd-utils.c | 5 +- xlators/mgmt/glusterd/src/glusterd-volgen.c | 35 +---- xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 51 ------- xlators/mgmt/glusterd/src/glusterd-volume-set.c | 43 ------ 7 files changed, 4 insertions(+), 335 deletions(-) (limited to 'xlators/mgmt') diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c index e6ea9c9881d..3079f1990e7 100644 --- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c @@ -117,110 +117,6 @@ insert_brick: return 0; } -static int -gd_addbr_validate_stripe_count(glusterd_volinfo_t *volinfo, int stripe_count, - int total_bricks, int *type, char *err_str, - size_t err_len) -{ - int ret = -1; - - switch (volinfo->type) { - case GF_CLUSTER_TYPE_NONE: - if ((volinfo->brick_count * stripe_count) == total_bricks) { - /* Change the volume type */ - *type = GF_CLUSTER_TYPE_STRIPE; - gf_msg(THIS->name, GF_LOG_INFO, 0, - GD_MSG_VOL_TYPE_CHANGING_INFO, - "Changing the type of volume %s from " - "'distribute' to 'stripe'", - volinfo->volname); - ret = 0; - goto out; - } else { - snprintf(err_str, err_len, - "Incorrect number of " - "bricks (%d) supplied for stripe count (%d).", - (total_bricks - volinfo->brick_count), stripe_count); - gf_msg(THIS->name, GF_LOG_ERROR, EINVAL, GD_MSG_INVALID_ENTRY, - "%s", err_str); - goto out; - } - break; - case GF_CLUSTER_TYPE_REPLICATE: - if (!(total_bricks % (volinfo->replica_count * stripe_count))) { - /* Change the volume type */ - *type = GF_CLUSTER_TYPE_STRIPE_REPLICATE; - gf_msg(THIS->name, GF_LOG_INFO, 0, - GD_MSG_VOL_TYPE_CHANGING_INFO, - "Changing the type of volume %s from " - "'replicate' to 'replicate-stripe'", - volinfo->volname); - ret = 0; - goto out; - } else { - snprintf(err_str, err_len, - "Incorrect number of " - "bricks (%d) supplied for changing volume's " - "stripe count to %d, need at least %d bricks", - (total_bricks - volinfo->brick_count), stripe_count, - (volinfo->replica_count * stripe_count)); - gf_msg(THIS->name, GF_LOG_ERROR, EINVAL, GD_MSG_INVALID_ENTRY, - "%s", err_str); - goto out; - } - break; - case GF_CLUSTER_TYPE_STRIPE: - case GF_CLUSTER_TYPE_STRIPE_REPLICATE: - if (stripe_count < volinfo->stripe_count) { - snprintf(err_str, err_len, - "Incorrect stripe count (%d) supplied. " - "Volume already has stripe count (%d)", - stripe_count, volinfo->stripe_count); - gf_msg(THIS->name, GF_LOG_ERROR, EINVAL, GD_MSG_INVALID_ENTRY, - "%s", err_str); - goto out; - } - if (stripe_count == volinfo->stripe_count) { - if (!(total_bricks % volinfo->dist_leaf_count)) { - /* its same as the one which exists */ - ret = 1; - goto out; - } - } - if (stripe_count > volinfo->stripe_count) { - /* We have to make sure before and after 'add-brick', - the number or subvolumes for distribute will remain - same, when stripe count is given */ - if ((volinfo->brick_count * - (stripe_count * volinfo->replica_count)) == - (total_bricks * volinfo->dist_leaf_count)) { - /* Change the dist_leaf_count */ - gf_msg(THIS->name, GF_LOG_INFO, 0, - GD_MSG_STRIPE_COUNT_CHANGE_INFO, - "Changing the stripe count of " - "volume %s from %d to %d", - volinfo->volname, volinfo->stripe_count, - stripe_count); - ret = 0; - goto out; - } - } - break; - case GF_CLUSTER_TYPE_DISPERSE: - snprintf(err_str, err_len, - "Volume %s cannot be converted " - "from dispersed to striped-" - "dispersed", - volinfo->volname); - gf_msg(THIS->name, GF_LOG_ERROR, EPERM, GD_MSG_OP_NOT_PERMITTED, - "%s", err_str); - goto out; - } - -out: - return ret; -} - static int gd_addbr_validate_replica_count(glusterd_volinfo_t *volinfo, int replica_count, int arbiter_count, int total_bricks, int *type, @@ -252,32 +148,7 @@ gd_addbr_validate_replica_count(glusterd_volinfo_t *volinfo, int replica_count, goto out; } break; - case GF_CLUSTER_TYPE_STRIPE: - if (!(total_bricks % (volinfo->dist_leaf_count * replica_count))) { - /* Change the volume type */ - *type = GF_CLUSTER_TYPE_STRIPE_REPLICATE; - gf_msg(THIS->name, GF_LOG_INFO, 0, - GD_MSG_VOL_TYPE_CHANGING_INFO, - "Changing the type of volume %s from " - "'stripe' to 'replicate-stripe'", - volinfo->volname); - ret = 0; - goto out; - } else { - snprintf(err_str, err_len, - "Incorrect number of " - "bricks (%d) supplied for changing volume's " - "replica count to %d, need at least %d " - "bricks", - (total_bricks - volinfo->brick_count), replica_count, - (volinfo->dist_leaf_count * replica_count)); - gf_msg(THIS->name, GF_LOG_ERROR, EINVAL, GD_MSG_INVALID_ENTRY, - "%s", err_str); - goto out; - } - break; case GF_CLUSTER_TYPE_REPLICATE: - case GF_CLUSTER_TYPE_STRIPE_REPLICATE: if (replica_count < volinfo->replica_count) { snprintf(err_str, err_len, "Incorrect replica count (%d) supplied. " @@ -348,7 +219,6 @@ gd_rmbr_validate_replica_count(glusterd_volinfo_t *volinfo, goto out; case GF_CLUSTER_TYPE_NONE: - case GF_CLUSTER_TYPE_STRIPE: case GF_CLUSTER_TYPE_DISPERSE: snprintf(err_str, err_len, "replica count (%d) option given for non replicate " @@ -359,7 +229,6 @@ gd_rmbr_validate_replica_count(glusterd_volinfo_t *volinfo, goto out; case GF_CLUSTER_TYPE_REPLICATE: - case GF_CLUSTER_TYPE_STRIPE_REPLICATE: /* in remove brick, you can only reduce the replica count */ if (replica_count > volinfo->replica_count) { snprintf(err_str, err_len, @@ -601,31 +470,6 @@ __glusterd_handle_add_brick(rpcsvc_request_t *req) count is given */ } - /* These bricks needs to be added one per a replica or stripe volume */ - if (stripe_count) { - ret = gd_addbr_validate_stripe_count(volinfo, stripe_count, - total_bricks, &type, err_str, - sizeof(err_str)); - if (ret == -1) { - gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_COUNT_VALIDATE_FAILED, - "%s", err_str); - goto out; - } - - /* if stripe count is same as earlier, set it back to 0 */ - if (ret == 1) - stripe_count = 0; - - ret = dict_set_int32n(dict, "stripe-count", SLEN("stripe-count"), - stripe_count); - if (ret) { - gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_GET_FAILED, - "failed to set the stripe-count in dict"); - goto out; - } - goto brick_val; - } - ret = gd_addbr_validate_replica_count(volinfo, replica_count, arbiter_count, total_bricks, &type, err_str, sizeof(err_str)); @@ -829,8 +673,7 @@ glusterd_remove_brick_validate_arbiters(glusterd_volinfo_t *volinfo, glusterd_brickinfo_t *last = NULL; char *arbiter_array = NULL; - if ((volinfo->type != GF_CLUSTER_TYPE_REPLICATE) && - (volinfo->type != GF_CLUSTER_TYPE_STRIPE_REPLICATE)) + if (volinfo->type != GF_CLUSTER_TYPE_REPLICATE) goto out; if (!replica_count || !volinfo->arbiter_count) @@ -1028,39 +871,12 @@ __glusterd_handle_remove_brick(rpcsvc_request_t *req) /* 'vol_type' is used for giving the meaning full error msg for user */ if (volinfo->type == GF_CLUSTER_TYPE_REPLICATE) { strcpy(vol_type, "replica"); - } else if (volinfo->type == GF_CLUSTER_TYPE_STRIPE) { - strcpy(vol_type, "stripe"); - } else if (volinfo->type == GF_CLUSTER_TYPE_STRIPE_REPLICATE) { - strcpy(vol_type, "stripe-replicate"); } else if (volinfo->type == GF_CLUSTER_TYPE_DISPERSE) { strcpy(vol_type, "disperse"); } else { strcpy(vol_type, "distribute"); } - /* Do not allow remove-brick if the volume is a stripe volume*/ - if ((volinfo->type == GF_CLUSTER_TYPE_STRIPE) && - (volinfo->brick_count == volinfo->stripe_count)) { - snprintf(err_str, sizeof(err_str), - "Removing brick from a stripe volume is not allowed"); - gf_msg(this->name, GF_LOG_ERROR, EPERM, GD_MSG_OP_NOT_PERMITTED, "%s", - err_str); - ret = -1; - goto out; - } - - if (!replica_count && (volinfo->type == GF_CLUSTER_TYPE_STRIPE_REPLICATE) && - (volinfo->brick_count == volinfo->dist_leaf_count)) { - snprintf(err_str, sizeof(err_str), - "Removing bricks from stripe-replicate" - " configuration is not allowed without reducing " - "replica or stripe count explicitly."); - gf_msg(this->name, GF_LOG_ERROR, EPERM, GD_MSG_OP_NOT_PERMITTED_AC_REQD, - "%s", err_str); - ret = -1; - goto out; - } - if (!replica_count && (volinfo->type == GF_CLUSTER_TYPE_REPLICATE) && (volinfo->brick_count == volinfo->dist_leaf_count)) { snprintf(err_str, sizeof(err_str), @@ -3013,10 +2829,6 @@ glusterd_op_remove_brick(dict_t *dict, char **op_errstr) volinfo->type = GF_CLUSTER_TYPE_NONE; /* backward compatibility */ volinfo->sub_count = 0; - } else { - volinfo->type = GF_CLUSTER_TYPE_STRIPE; - /* backward compatibility */ - volinfo->sub_count = volinfo->dist_leaf_count; } } } diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c index a05fd6d0c98..3e12b61b71b 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.c +++ b/xlators/mgmt/glusterd/src/glusterd-store.c @@ -3180,22 +3180,11 @@ glusterd_store_update_volinfo(glusterd_volinfo_t *volinfo) volinfo->replica_count = 1; break; - case GF_CLUSTER_TYPE_STRIPE: - volinfo->stripe_count = volinfo->sub_count; - volinfo->replica_count = 1; - break; - case GF_CLUSTER_TYPE_REPLICATE: volinfo->stripe_count = 1; volinfo->replica_count = volinfo->sub_count; break; - case GF_CLUSTER_TYPE_STRIPE_REPLICATE: - /* Introduced in 3.3 */ - GF_ASSERT(volinfo->stripe_count > 0); - GF_ASSERT(volinfo->replica_count > 0); - break; - case GF_CLUSTER_TYPE_DISPERSE: GF_ASSERT(volinfo->disperse_count > 0); GF_ASSERT(volinfo->redundancy_count > 0); diff --git a/xlators/mgmt/glusterd/src/glusterd-tier.c b/xlators/mgmt/glusterd/src/glusterd-tier.c index e980026d8ec..9cc1b4a225e 100644 --- a/xlators/mgmt/glusterd/src/glusterd-tier.c +++ b/xlators/mgmt/glusterd/src/glusterd-tier.c @@ -593,10 +593,6 @@ glusterd_op_remove_tier_brick(dict_t *dict, char **op_errstr, dict_t *rsp_dict) volinfo->type = GF_CLUSTER_TYPE_NONE; /* backward compatibility */ volinfo->sub_count = 0; - } else { - volinfo->type = GF_CLUSTER_TYPE_STRIPE; - /* backward compatibility */ - volinfo->sub_count = volinfo->dist_leaf_count; } } } diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 757560e68d1..7b8369f623b 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -8265,8 +8265,7 @@ out: static inline int glusterd_is_replica_volume(int type) { - if (type == GF_CLUSTER_TYPE_REPLICATE || - type == GF_CLUSTER_TYPE_STRIPE_REPLICATE) + if (type == GF_CLUSTER_TYPE_REPLICATE) return 1; return 0; } @@ -8287,7 +8286,6 @@ glusterd_is_shd_compatible_type(int type) { switch (type) { case GF_CLUSTER_TYPE_REPLICATE: - case GF_CLUSTER_TYPE_STRIPE_REPLICATE: case GF_CLUSTER_TYPE_DISPERSE: return _gf_true; } @@ -13814,7 +13812,6 @@ gd_get_shd_key(int type) switch (type) { case GF_CLUSTER_TYPE_REPLICATE: - case GF_CLUSTER_TYPE_STRIPE_REPLICATE: key = "cluster.self-heal-daemon"; break; case GF_CLUSTER_TYPE_DISPERSE: diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 13b289fdcb8..57b0fccac3b 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -2207,8 +2207,7 @@ brick_graph_add_index(volgen_graph_t *graph, glusterd_volinfo_t *volinfo, if (ret) goto out; } - if ((volinfo->type == GF_CLUSTER_TYPE_STRIPE_REPLICATE || - volinfo->type == GF_CLUSTER_TYPE_REPLICATE || + if ((volinfo->type == GF_CLUSTER_TYPE_REPLICATE || volinfo->type == GF_CLUSTER_TYPE_NONE)) { ret = xlator_set_option(xl, "xattrop-dirty-watchlist", "trusted.afr.dirty"); @@ -2881,8 +2880,7 @@ perfxl_option_handler(volgen_graph_t *graph, struct volopt_map_entry *vme, * performance */ if (!strcmp(vme->key, "performance.client-io-threads") && - (GF_CLUSTER_TYPE_STRIPE_REPLICATE == volinfo->type || - GF_CLUSTER_TYPE_REPLICATE == volinfo->type)) + (GF_CLUSTER_TYPE_REPLICATE == volinfo->type)) return 0; } @@ -3894,8 +3892,6 @@ volume_volgen_graph_build_clusters(volgen_graph_t *graph, gf_boolean_t is_quotad) { char *tier_args[] = {"cluster/tier", "%s-tier-%d"}; - char *stripe_args[] = {"cluster/stripe", "%s-stripe-%d"}; - int rclusters = 0; int clusters = 0; int dist_count = 0; int ret = -1; @@ -3916,35 +3912,11 @@ volume_volgen_graph_build_clusters(volgen_graph_t *graph, if (clusters < 0) goto out; break; - case GF_CLUSTER_TYPE_STRIPE: - clusters = volgen_link_bricks_from_list_tail( - graph, volinfo, stripe_args[0], stripe_args[1], - volinfo->brick_count, volinfo->stripe_count); - if (clusters < 0) - goto out; - break; case GF_CLUSTER_TYPE_TIER: ret = volgen_link_bricks_from_list_head( graph, volinfo, tier_args[0], tier_args[1], volinfo->brick_count, volinfo->replica_count); break; - case GF_CLUSTER_TYPE_STRIPE_REPLICATE: - /* Replicate after the clients, then stripe */ - if (volinfo->replica_count == 0) - goto out; - clusters = volgen_graph_build_afr_clusters(graph, volinfo); - if (clusters < 0) - goto out; - - rclusters = volinfo->brick_count / volinfo->replica_count; - GF_ASSERT(rclusters == clusters); - clusters = volgen_link_bricks_from_list_tail( - graph, volinfo, stripe_args[0], stripe_args[1], rclusters, - volinfo->stripe_count); - if (clusters < 0) - goto out; - break; - case GF_CLUSTER_TYPE_DISPERSE: clusters = volgen_graph_build_ec_clusters(graph, volinfo); if (clusters < 0) @@ -4867,7 +4839,6 @@ volgen_get_shd_key(int type) switch (type) { case GF_CLUSTER_TYPE_REPLICATE: - case GF_CLUSTER_TYPE_STRIPE_REPLICATE: key = "cluster.self-heal-daemon"; break; case GF_CLUSTER_TYPE_DISPERSE: @@ -4971,7 +4942,6 @@ build_afr_ec_clusters(volgen_graph_t *graph, glusterd_volinfo_t *volinfo) int clusters = -1; switch (volinfo->type) { case GF_CLUSTER_TYPE_REPLICATE: - case GF_CLUSTER_TYPE_STRIPE_REPLICATE: clusters = volgen_graph_build_afr_clusters(graph, volinfo); break; @@ -5061,7 +5031,6 @@ gd_is_self_heal_enabled(glusterd_volinfo_t *volinfo, dict_t *dict) switch (volinfo->type) { case GF_CLUSTER_TYPE_REPLICATE: - case GF_CLUSTER_TYPE_STRIPE_REPLICATE: case GF_CLUSTER_TYPE_DISPERSE: shd_key = volgen_get_shd_key(volinfo->type); shd_enabled = dict_get_str_boolean(dict, shd_key, _gf_true); diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index 53c3591d4f8..d65a1f9f977 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -1433,7 +1433,6 @@ glusterd_op_stage_create_volume(dict_t *dict, char **op_errstr, if (!is_force) { if ((type == GF_CLUSTER_TYPE_REPLICATE) || - (type == GF_CLUSTER_TYPE_STRIPE_REPLICATE) || (type == GF_CLUSTER_TYPE_DISPERSE)) { ret = glusterd_check_brick_order(dict, msg); if (ret) { @@ -2372,56 +2371,6 @@ glusterd_op_create_volume(dict_t *dict, char **op_errstr) goto out; } - /* coverity[unused_value] arbiter count is optional */ - ret = dict_get_int32n(dict, "arbiter-count", SLEN("arbiter-count"), - &volinfo->arbiter_count); - } else if (GF_CLUSTER_TYPE_STRIPE == volinfo->type) { - ret = dict_get_int32n(dict, "stripe-count", SLEN("stripe-count"), - &volinfo->stripe_count); - if (ret) { - gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED, - "Failed to get stripe" - " count for volume %s", - volname); - 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_nstrn(volinfo->dict, "performance.client-io-threads", - SLEN("performance.client-io-threads"), "off", - SLEN("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_int32n(dict, "stripe-count", SLEN("stripe-count"), - &volinfo->stripe_count); - if (ret) { - gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED, - "Failed to get stripe" - " count for volume %s", - volname); - goto out; - } - ret = dict_get_int32n(dict, "replica-count", SLEN("replica-count"), - &volinfo->replica_count); - if (ret) { - gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED, - "Failed to get " - "replica count for volume %s", - volname); - goto out; - } - /* coverity[unused_value] arbiter count is optional */ ret = dict_get_int32n(dict, "arbiter-count", SLEN("arbiter-count"), &volinfo->arbiter_count); diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c index dab515d7161..988d547e14e 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c @@ -765,36 +765,6 @@ out: return ret; } -static int -validate_stripe(glusterd_volinfo_t *volinfo, dict_t *dict, char *key, - char *value, char **op_errstr) -{ - char errstr[2048] = ""; - glusterd_conf_t *priv = NULL; - int ret = 0; - xlator_t *this = NULL; - - this = THIS; - GF_ASSERT(this); - priv = this->private; - GF_ASSERT(priv); - - if (volinfo->stripe_count == 1) { - snprintf(errstr, sizeof(errstr), - "Cannot set %s for a non-stripe volume.", key); - gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_NON_STRIPE_VOL, "%s", - errstr); - *op_errstr = gf_strdup(errstr); - ret = -1; - goto out; - } - -out: - gf_msg_debug(this->name, 0, "Returning %d", ret); - - return ret; -} - static int validate_disperse(glusterd_volinfo_t *volinfo, dict_t *dict, char *key, char *value, char **op_errstr) @@ -1539,19 +1509,6 @@ struct volopt_map_entry glusterd_volopt_map[] = { .op_version = GD_OP_VERSION_3_13_2, .flags = VOLOPT_FLAG_CLIENT_OPT}, - /* stripe xlator options */ - {.key = "cluster.stripe-block-size", - .voltype = "cluster/stripe", - .option = "block-size", - .op_version = 1, - .validate_fn = validate_stripe, - .flags = VOLOPT_FLAG_CLIENT_OPT}, - {.key = "cluster.stripe-coalesce", - .voltype = "cluster/stripe", - .option = "coalesce", - .op_version = 1, - .flags = VOLOPT_FLAG_CLIENT_OPT}, - /* IO-stats xlator options */ {.key = VKEY_DIAG_LAT_MEASUREMENT, .voltype = "debug/io-stats", -- cgit