diff options
author | N Balachandran <nbalacha@redhat.com> | 2017-06-19 11:50:28 +0530 |
---|---|---|
committer | Raghavendra Talur <rtalur@redhat.com> | 2017-07-04 14:39:20 +0000 |
commit | b8cdcca098728c5c12cc37606c8837a9b7a13c2f (patch) | |
tree | 9685e3a5b2f83c68d05cda480c4aaa9cb63cf932 | |
parent | 763d04016f94a32b74e163ecda840ed4114e3435 (diff) |
cluster/dht: Additional checks for rebalance estimates
The rebalance estimates calculation was not handling
calculations correctly when no files had been processed,
i.e., when rate_lookedup was 0.
Now, the estimated time is set to 0 in such scenarios as
there is no way for rebalance to figure out how long the
process will take to complete without knowing the rate at
which the files are being processed.
> BUG: 1457985
> Signed-off-by: N Balachandran <nbalacha@redhat.com>
> Reviewed-on: https://review.gluster.org/17564
> 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: Amar Tumballi <amarts@redhat.com>
> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Change-Id: I7b6378e297e1ba139852bcb2239adf2477336b5b
BUG: 1460914
Signed-off-by: N Balachandran <nbalacha@redhat.com>
Reviewed-on: https://review.gluster.org/17599
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
-rw-r--r-- | xlators/cluster/dht/src/dht-rebalance.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index 0e492e66d13..99a2709af4e 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -4241,9 +4241,10 @@ gf_defrag_get_estimates (dht_conf_t *conf) rate_lookedup = (total_processed)/elapsed; - /* We initially sum up dirs across all local subvols. - * The same directories will be counted for each subvol so - * we want to ensure that they are only counted once. + /* We initially sum up dirs across all local subvols because we get the + * file count from the inodes on each subvol. + * The same directories will be counted for each subvol but + * we want that they are only counted once. */ tmp_count = g_totalfiles @@ -4252,7 +4253,14 @@ gf_defrag_get_estimates (dht_conf_t *conf) if (total_processed > g_totalfiles) g_totalfiles = total_processed + 10000; - time_to_complete = (tmp_count)/rate_lookedup; + if (rate_lookedup) { + time_to_complete = (tmp_count)/rate_lookedup; + + } else { + + gf_msg (THIS->name, GF_LOG_ERROR, 0, 0, + "Unable to calculate estimated time for rebalance"); + } gf_log (THIS->name, GF_LOG_INFO, "TIME: total_processed=%"PRIu64" tmp_cnt = %"PRIu64"," @@ -4305,7 +4313,9 @@ gf_defrag_status_get (dht_conf_t *conf, dict_t *dict) && (defrag->defrag_status == GF_DEFRAG_STATUS_STARTED)) { time_to_complete = gf_defrag_get_estimates (conf); - time_left = time_to_complete - elapsed; + + if (time_to_complete && (time_to_complete > elapsed)) + time_left = time_to_complete - elapsed; gf_log (THIS->name, GF_LOG_INFO, "TIME: Estimated total time to complete = %"PRIu64 |