diff options
author | Susant Palai <spalai@redhat.com> | 2017-06-21 17:52:45 +0530 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2017-06-26 10:47:00 +0000 |
commit | 4700c5be55b0e567755b4c8a1a91f33d29c06e6b (patch) | |
tree | c0f85caba100c9f9d46dd61f3cdd96c407a19d5a /xlators/cluster/dht/src/tier.c | |
parent | d66fb14a952729caf51c8328448a548c4d198082 (diff) |
cluster/rebalance: Use GF_XATTR_LIST_NODE_UUIDS_KEY to figure out local subvols.
Afr has introduced a new key GF_XATTR_LIST_NODE_UUIDS_KEY,
through which rebalance will figure out its local subvolumes.(Reference
bugid=1463250)
key: GF_XATTR_NODE_UUID_KEY will continue to serve it's old
purpose of returning the first afr chiild.
test: prove tests/basic/distribute/rebal-all-nodes-migrate.t
Change-Id: I4d602feda2a05b29d2210c712a07a4ac6b8bc112
BUG: 1463648
Signed-off-by: Susant Palai <spalai@redhat.com>
Signed-off-by: N Balachandran <nbalacha@redhat.com>
Reviewed-on: https://review.gluster.org/17595
Smoke: Gluster Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src/tier.c')
-rw-r--r-- | xlators/cluster/dht/src/tier.c | 50 |
1 files changed, 1 insertions, 49 deletions
diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c index 01b6ada3677..c8667228c59 100644 --- a/xlators/cluster/dht/src/tier.c +++ b/xlators/cluster/dht/src/tier.c @@ -202,13 +202,6 @@ tier_check_same_node (xlator_t *this, loc_t *loc, gf_defrag_info_t *defrag) dict_t *dict = NULL; char *uuid_str = NULL; uuid_t node_uuid = {0,}; - char *dup_str = NULL; - char *str = NULL; - char *save_ptr = NULL; - int count = 0; - uint32_t hashval = 0; - int32_t index = 0; - char buf[GF_UUID_BUF_SIZE] = {0,}; GF_VALIDATE_OR_GOTO ("tier", this, out); GF_VALIDATE_OR_GOTO (this->name, loc, out); @@ -222,56 +215,16 @@ tier_check_same_node (xlator_t *this, loc_t *loc, gf_defrag_info_t *defrag) goto out; } - - /* This returns multiple node-uuids now - one for each brick - * of the subvol. - */ - if (dict_get_str (dict, GF_XATTR_NODE_UUID_KEY, &uuid_str) < 0) { gf_msg (this->name, GF_LOG_ERROR, 0, DHT_MSG_LOG_TIER_ERROR, - "Failed to get node-uuid for %s", loc->path); + "Failed to get node-uuids for %s", loc->path); goto out; } - dup_str = gf_strdup (uuid_str); - str = dup_str; - - /* How many uuids returned? - * No need to check if one of these is that of the current node. - */ - - count = 1; - while ((str = strchr (str, ' '))) { - count++; - str++; - } - - /* Only one node-uuid - pure distribute? */ - if (count == 1) - goto check_node; - - uuid_utoa_r (loc->gfid, buf); - ret = dht_hash_compute (this, 0, buf, &hashval); - if (ret == 0) { - index = (hashval % count); - } - - count = 0; - str = dup_str; - while ((uuid_str = strtok_r (str, " ", &save_ptr))) { - if (count == index) - break; - count++; - str = NULL; - } - - -check_node: if (gf_uuid_parse (uuid_str, node_uuid)) { gf_msg (this->name, GF_LOG_ERROR, 0, DHT_MSG_LOG_TIER_ERROR, "uuid_parse failed for %s", loc->path); - ret = -1; goto out; } @@ -287,7 +240,6 @@ out: if (dict) dict_unref(dict); - GF_FREE (dup_str); return ret; } |