summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
diff options
context:
space:
mode:
authorshishirng <shishirng@gluster.com>2012-03-06 18:55:37 +0530
committerVijay Bellur <vijay@gluster.com>2012-03-07 21:14:27 -0800
commit33e9f9da8546dc57ecf6b3705f6b6474150ec78c (patch)
tree9455c2dcd9f49e7ff8b50fdcc3fb6d8b0534c975 /xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
parentf6a779ffc5b515163995dc2d240c3271cc6bceeb (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-rpc-ops.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rpc-ops.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
index 39a9c6161a9..4e55c383c47 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
@@ -1059,6 +1059,8 @@ glusterd_volume_rebalance_use_rsp_dict (dict_t *rsp_dict)
glusterd_op_t op = GD_OP_NONE;
uint64_t value = 0;
int32_t value32 = 0;
+ char *volname = NULL;
+ glusterd_volinfo_t *volinfo = NULL;
GF_ASSERT (rsp_dict);
@@ -1071,9 +1073,22 @@ glusterd_volume_rebalance_use_rsp_dict (dict_t *rsp_dict)
if (!ctx_dict)
goto out;
+ ret = dict_get_str (ctx_dict, "volname", &volname);
+ if (ret) {
+ gf_log ("", GF_LOG_ERROR, "Unable to get volume name");
+ goto out;
+ }
+
+ ret = glusterd_volinfo_find (volname, &volinfo);
+
+ if (ret)
+ goto out;
+
ret = dict_get_uint64 (rsp_dict, "files", &value);
if (!ret) {
- ret = dict_set_uint64 (ctx_dict, "files", value);
+ volinfo->rebalance_files += value;
+ ret = dict_set_uint64 (ctx_dict, "files",
+ volinfo->rebalance_files);
if (ret) {
gf_log (THIS->name, GF_LOG_DEBUG,
"failed to set the file count");
@@ -1082,7 +1097,9 @@ glusterd_volume_rebalance_use_rsp_dict (dict_t *rsp_dict)
ret = dict_get_uint64 (rsp_dict, "size", &value);
if (!ret) {
- ret = dict_set_uint64 (ctx_dict, "size", value);
+ volinfo->rebalance_data += value;
+ ret = dict_set_uint64 (ctx_dict, "size",
+ volinfo->rebalance_data);
if (ret) {
gf_log (THIS->name, GF_LOG_DEBUG,
"failed to set the size of migration");
@@ -1091,7 +1108,9 @@ glusterd_volume_rebalance_use_rsp_dict (dict_t *rsp_dict)
ret = dict_get_uint64 (rsp_dict, "lookups", &value);
if (!ret) {
- ret = dict_set_uint64 (ctx_dict, "lookups", value);
+ volinfo->lookedup_files += value;
+ ret = dict_set_uint64 (ctx_dict, "lookups",
+ volinfo->lookedup_files);
if (ret) {
gf_log (THIS->name, GF_LOG_DEBUG,
"failed to set lookuped file count");
@@ -1273,6 +1292,9 @@ glusterd3_1_commit_op_cbk (struct rpc_req *req, struct iovec *iov,
case GD_OP_REBALANCE:
case GD_OP_DEFRAG_BRICK_VOLUME:
+ ret = glusterd_volume_rebalance_use_rsp_dict (dict);
+ if (ret)
+ goto out;
break;
case GD_OP_HEAL_VOLUME: