diff options
author | Atin Mukherjee <amukherj@redhat.com> | 2016-07-03 15:51:20 +0530 |
---|---|---|
committer | Kaushal M <kaushal@redhat.com> | 2016-07-07 02:33:41 -0700 |
commit | c93839ed1b4d10e492a6e0aacb19e42c761d4bf3 (patch) | |
tree | b42555f4e2525088fd00e1eb89feda23be336fa6 | |
parent | bddf6f8e6909ea1a3a9f240ca3a7515aea4e35b4 (diff) |
glusterd: compare uuid instead of hostname address resolution
Backport of http://review.gluster.org/14849
In glusterd_get_brickinfo () brick's hostname is address resolved. This adds an
unnecessary latency since it uses calls like getaddrinfo (). Instead given the
local brick's uuid is already known a comparison of MY_UUID and brickinfo->uuid
is much more light weight than the previous approach.
On a scale testing where cluster hosting ~400 volumes spanning across 4 nodes,
if a node goes for a reboot, few of the bricks don't come up. After few days of
analysis its found that glusterd_pmap_sigin () was taking signficant amount of
latency and further code walthrough revealed this unnecessary address
resolution. Applying this fix solves the issue and now all the brick processes
come up on a node reboot.
Change-Id: I299b8660ce0da6f3f739354f5c637bc356d82133
BUG: 1352833
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: http://review.gluster.org/14849
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: Prashanth Pai <ppai@redhat.com>
Reviewed-by: Samikshan Bairagya <samikshan@gmail.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/14861
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-pmap.c | 6 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 4 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.h | 5 |
3 files changed, 6 insertions, 9 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-pmap.c b/xlators/mgmt/glusterd/src/glusterd-pmap.c index ea35c57ac32..b5b8140e8b7 100644 --- a/xlators/mgmt/glusterd/src/glusterd-pmap.c +++ b/xlators/mgmt/glusterd/src/glusterd-pmap.c @@ -420,8 +420,7 @@ __gluster_pmap_signin (rpcsvc_request_t *req) rsp.op_ret = pmap_registry_bind (THIS, args.port, args.brick, GF_PMAP_PORT_BRICKSERVER, req->trans); - ret = glusterd_get_brickinfo (THIS, args.brick, args.port, _gf_true, - &brickinfo); + ret = glusterd_get_brickinfo (THIS, args.brick, args.port, &brickinfo); fail: glusterd_submit_reply (req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_pmap_signin_rsp); @@ -461,8 +460,7 @@ __gluster_pmap_signout (rpcsvc_request_t *req) rsp.op_ret = pmap_registry_remove (THIS, args.port, args.brick, GF_PMAP_PORT_BRICKSERVER, req->trans); - ret = glusterd_get_brickinfo (THIS, args.brick, args.port, _gf_true, - &brickinfo); + ret = glusterd_get_brickinfo (THIS, args.brick, args.port, &brickinfo); if (args.rdma_port) { snprintf(brick_path, PATH_MAX, "%s.rdma", args.brick); rsp.op_ret = pmap_registry_remove (THIS, args.rdma_port, diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index c26ca241f91..0ea19438df7 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -5095,7 +5095,7 @@ glusterd_get_dist_leaf_count (glusterd_volinfo_t *volinfo) int glusterd_get_brickinfo (xlator_t *this, const char *brickname, int port, - gf_boolean_t localhost, glusterd_brickinfo_t **brickinfo) + glusterd_brickinfo_t **brickinfo) { glusterd_conf_t *priv = NULL; glusterd_volinfo_t *volinfo = NULL; @@ -5109,7 +5109,7 @@ glusterd_get_brickinfo (xlator_t *this, const char *brickname, int port, cds_list_for_each_entry (volinfo, &priv->volumes, vol_list) { cds_list_for_each_entry (tmpbrkinfo, &volinfo->bricks, brick_list) { - if (localhost && !gf_is_local_addr (tmpbrkinfo->hostname)) + if (gf_uuid_compare (tmpbrkinfo->uuid, MY_UUID)) continue; if (!strcmp(tmpbrkinfo->path, brickname) && (tmpbrkinfo->port == port)) { diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h index b508b01d2b0..83750908aaa 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.h +++ b/xlators/mgmt/glusterd/src/glusterd-utils.h @@ -207,12 +207,11 @@ glusterd_add_volume_to_dict (glusterd_volinfo_t *volinfo, char *prefix); int glusterd_get_brickinfo (xlator_t *this, const char *brickname, - int port, gf_boolean_t localhost, - glusterd_brickinfo_t **brickinfo); + int port, glusterd_brickinfo_t **brickinfo); void glusterd_set_brick_status (glusterd_brickinfo_t *brickinfo, - gf_brick_status_t status); + gf_brick_status_t status); gf_boolean_t glusterd_is_brick_started (glusterd_brickinfo_t *brickinfo); |