diff options
author | karthik-us <ksubrahm@redhat.com> | 2017-04-19 18:04:46 +0530 |
---|---|---|
committer | Raghavendra Talur <rtalur@redhat.com> | 2017-05-30 13:13:27 +0000 |
commit | 29ce31a5080a63690cbaf5dc917bfa9fcb19e8aa (patch) | |
tree | 415b18761bc0d833b3ae78f1bc38bda24fbc33ef /xlators/cluster/afr/src/afr-common.c | |
parent | a030f85da4d617a36d7fa9a3d815128d711a956b (diff) |
cluster/afr: Return the list of node_uuids for the subvolume
Problem:
AFR was returning the node uuid of the first node for every file if
the replica set was healthy, which was resulting in only one node
migrating all the files.
Fix:
With this patch AFR returns the list of node_uuids to the upper layer,
so that they can decide on which node to migrate which files, resulting
in improved performance. Ordering of node uuids will be maintained based
on the ordering of the bricks. If a brick is down, then the node uuid
for that will be set to all zeros.
> Reviewed-on: https://review.gluster.org/17084
> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
> Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
(cherry picked from commit 0a50167c0a8f950f5a1c76442b6c9abea466200d)
Change-Id: I73ee0f9898ae473584fdf487a2980d7a6db22f31
BUG: 1451561
Signed-off-by: karthik-us <ksubrahm@redhat.com>
Reviewed-on: https://review.gluster.org/17337
Tested-by: Ravishankar N <ravishankar@redhat.com>
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-common.c')
-rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 3a79dea128a..1a9d62181f8 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -6027,3 +6027,52 @@ mdata_unlock: return ret; } + +/* + * Concatenates the xattrs in local->replies separated by a delimiter. + */ +int +afr_serialize_xattrs_with_delimiter (call_frame_t *frame, xlator_t *this, + char *buf, const char *default_str, + int32_t *serz_len, char delimiter) +{ + afr_private_t *priv = NULL; + afr_local_t *local = NULL; + char *xattr = NULL; + int i = 0; + int len = 0; + int ret = -1; + + priv = this->private; + local = frame->local; + + for (i = 0; i < priv->child_count; i++) { + if (!local->replies[i].valid || local->replies[i].op_ret) { + buf = strncat (buf, default_str, strlen (default_str)); + len += strlen (default_str); + buf[len++] = delimiter; + buf[len] = '\0'; + } else { + ret = dict_get_str (local->replies[i].xattr, + local->cont.getxattr.name, &xattr); + if (ret) { + gf_msg ("TEST", GF_LOG_ERROR, -ret, + AFR_MSG_DICT_GET_FAILED, + "Failed to get the node_uuid of brick " + "%d", i); + goto out; + } + buf = strncat (buf, xattr, strlen (xattr)); + len += strlen (xattr); + buf[len++] = delimiter; + buf[len] = '\0'; + } + } + buf[--len] = '\0'; /*remove the last delimiter*/ + if (serz_len) + *serz_len = ++len; + ret = 0; + +out: + return ret; +} |