diff options
author | shishirng <shishirng@gluster.com> | 2012-03-06 18:55:37 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-03-07 21:14:27 -0800 |
commit | 33e9f9da8546dc57ecf6b3705f6b6474150ec78c (patch) | |
tree | 9455c2dcd9f49e7ff8b50fdcc3fb6d8b0534c975 /xlators/mgmt/glusterd/src/glusterd-rebalance.c | |
parent | f6a779ffc5b515163995dc2d240c3271cc6bceeb (diff) |
glusterd/rebalance: Bring in support for parallel rebalance
This patch, enables rebalance processes to be started on all
nodes where the volume is spread across (1 process per node)
node-uuid xattr identifies which node takes ownership of the
task to migrate the file. The model employed is push (src pushes
to dst)
Change-Id: Ieacd46a6216cf6ded841bbaebd10cfaea51c16d6
BUG: 763844
Signed-off-by: shishirng <shishirng@gluster.com>
Reviewed-on: http://review.gluster.com/2873
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-rebalance.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-rebalance.c | 82 |
1 files changed, 10 insertions, 72 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c index f7304b9c074..936a3b26e6c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c +++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c @@ -82,60 +82,6 @@ out: return ret; } -int -glusterd_defrag_status_get (glusterd_volinfo_t *volinfo, - dict_t *dict) -{ - int ret = 0; - uint64_t files = 0; - uint64_t size = 0; - uint64_t lookup = 0; - - if (!volinfo || !dict) - goto out; - - ret = 0; - if (volinfo->defrag_status == GF_DEFRAG_STATUS_NOT_STARTED) - goto out; - - if (volinfo->defrag) { - LOCK (&volinfo->defrag->lock); - { - files = volinfo->defrag->total_files; - size = volinfo->defrag->total_data; - lookup = volinfo->defrag->num_files_lookedup; - } - UNLOCK (&volinfo->defrag->lock); - } else { - files = volinfo->rebalance_files; - size = volinfo->rebalance_data; - lookup = volinfo->lookedup_files; - } - - ret = dict_set_uint64 (dict, "files", files); - if (ret) - gf_log (THIS->name, GF_LOG_WARNING, - "failed to set file count"); - - ret = dict_set_uint64 (dict, "size", size); - if (ret) - gf_log (THIS->name, GF_LOG_WARNING, - "failed to set size of xfer"); - - ret = dict_set_uint64 (dict, "lookups", lookup); - if (ret) - gf_log (THIS->name, GF_LOG_WARNING, - "failed to set lookedup file count"); - - ret = dict_set_int32 (dict, "status", volinfo->defrag_status); - if (ret) - gf_log (THIS->name, GF_LOG_WARNING, - "failed to set status"); - -out: - return 0; -} - void glusterd_rebalance_cmd_attempted_log (int cmd, char *volname) { @@ -338,6 +284,10 @@ glusterd_handle_defrag_start (glusterd_volinfo_t *volinfo, char *op_errstr, volinfo->defrag_status = GF_DEFRAG_STATUS_STARTED; + volinfo->rebalance_files = 0; + volinfo->rebalance_data = 0; + volinfo->lookedup_files = 0; + volinfo->defrag_cmd = cmd; glusterd_store_volinfo (volinfo, GLUSTERD_VOLINFO_VER_AC_INCREMENT); @@ -369,6 +319,8 @@ glusterd_handle_defrag_start (glusterd_volinfo_t *volinfo, char *op_errstr, NULL); runner_add_arg (&runner, "--xlator-option"); runner_argprintf ( &runner, "*dht.rebalance-cmd=%d",cmd); + runner_add_arg (&runner, "--xlator-option"); + runner_argprintf (&runner, "*dht.node-uuid=%s", uuid_utoa(priv->uuid)); runner_add_arg (&runner, "--socket-file"); runner_argprintf (&runner, "%s",sockfile); runner_add_arg (&runner, "--pid-file"); @@ -383,6 +335,7 @@ glusterd_handle_defrag_start (glusterd_volinfo_t *volinfo, char *op_errstr, goto out; } + sleep (5); ret = rpc_clnt_transport_unix_options_build (&options, sockfile); if (ret) { gf_log (THIS->name, GF_LOG_ERROR, "Unix options build failed"); @@ -609,7 +562,6 @@ glusterd_op_rebalance (dict_t *dict, char **op_errstr, dict_t *rsp_dict) int32_t cmd = 0; char msg[2048] = {0}; glusterd_volinfo_t *volinfo = NULL; - void *node_uuid = NULL; glusterd_conf_t *priv = NULL; priv = THIS->private; @@ -633,23 +585,6 @@ glusterd_op_rebalance (dict_t *dict, char **op_errstr, dict_t *rsp_dict) goto out; } - if ((cmd != GF_DEFRAG_CMD_STATUS) && - (cmd != GF_DEFRAG_CMD_STOP)) { - ret = dict_get_ptr (dict, "node-uuid", &node_uuid); - if (ret) { - gf_log (THIS->name, GF_LOG_DEBUG, "node-uuid not found"); - goto out; - } - - /* perform this on only the node which has - issued the command */ - if (uuid_compare (node_uuid, priv->uuid)) { - gf_log (THIS->name, GF_LOG_DEBUG, - "not the source node %s", uuid_utoa (priv->uuid)); - goto out; - } - } - switch (cmd) { case GF_DEFRAG_CMD_START: case GF_DEFRAG_CMD_START_LAYOUT_FIX: @@ -659,6 +594,9 @@ glusterd_op_rebalance (dict_t *dict, char **op_errstr, dict_t *rsp_dict) break; case GF_DEFRAG_CMD_STOP: case GF_DEFRAG_CMD_STATUS: + volinfo->rebalance_files = 0; + volinfo->rebalance_data = 0; + volinfo->lookedup_files = 0; break; default: break; |