summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorN Balachandran <nbalacha@redhat.com>2016-09-08 09:34:46 +0530
committerNiels de Vos <ndevos@redhat.com>2016-09-13 22:20:46 -0700
commit31b045060478e1c5066f6f9c4321970fbff398de (patch)
treee9ac44367c9bfe7fa27b464921dd0016263a9912
parente002798e8f85b67d67d34326b32f838541827bc5 (diff)
cluster/dht: Skip layout overlap maximization on weighted rebalance
During a fix-layout, dht_selfheal_layout_maximize_overlap () does not consider chunk sizes while calculating layout overlaps, causing smaller bricks to sometimes get larger ranges than larger bricks. Temporarily enabling this operation if only if weighted rebalance is disabled or all bricks are the same size. > Change-Id: I5ed16cdff2551b826a1759ca8338921640bfc7b3 > BUG: 1366494 > Signed-off-by: N Balachandran <nbalacha@redhat.com> > Reviewed-on: http://review.gluster.org/15403 > Smoke: Gluster Build System <jenkins@build.gluster.org> > CentOS-regression: Gluster Build System <jenkins@build.gluster.org> > Reviewed-by: Raghavendra G <rgowdapp@redhat.com> > NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> (cherry picked from commit b93692cce603006d9cb6750e08183bca742792ac) Change-Id: Icf0dd83f36912e721982bcf818a06c4b339dc974 BUG: 1374135 Signed-off-by: N Balachandran <nbalacha@redhat.com> Reviewed-on: http://review.gluster.org/15422 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Niels de Vos <ndevos@redhat.com>
-rwxr-xr-xtests/bugs/distribute/bug-853258.t1
-rw-r--r--xlators/cluster/dht/src/dht-selfheal.c25
2 files changed, 22 insertions, 4 deletions
diff --git a/tests/bugs/distribute/bug-853258.t b/tests/bugs/distribute/bug-853258.t
index 2f0e1b8b9b7..e39f507baf9 100755
--- a/tests/bugs/distribute/bug-853258.t
+++ b/tests/bugs/distribute/bug-853258.t
@@ -17,6 +17,7 @@ mkdir -p $H0:$B0/${V0}3
TEST $CLI volume create $V0 $H0:$B0/${V0}0 $H0:$B0/${V0}1 $H0:$B0/${V0}2
TEST $CLI volume start $V0
EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'Started' volinfo_field $V0 'Status';
+TEST $CLI volume set $V0 cluster.weighted-rebalance off
# Force assignment of initial ranges.
TEST $CLI volume rebalance $V0 fix-layout start
diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c
index 520a3f3e88c..85fd93f9348 100644
--- a/xlators/cluster/dht/src/dht-selfheal.c
+++ b/xlators/cluster/dht/src/dht-selfheal.c
@@ -1706,6 +1706,7 @@ dht_fix_layout_of_directory (call_frame_t *frame, loc_t *loc,
dht_local_t *local = NULL;
uint32_t subvol_down = 0;
int ret = 0;
+ gf_boolean_t maximize_overlap = _gf_true;
this = frame->this;
priv = this->private;
@@ -1752,9 +1753,18 @@ dht_fix_layout_of_directory (call_frame_t *frame, loc_t *loc,
"subvolume %d (%s): %u chunks", i,
priv->subvolumes[i]->name,
priv->du_stats[i].chunks);
+
+ /* Maximize overlap if the bricks are all the same
+ * size.
+ * This is probably not going to be very common on
+ * live setups but will benefit our regression tests
+ */
+ if (i && (priv->du_stats[i].chunks
+ != priv->du_stats[0].chunks)) {
+ maximize_overlap = _gf_false;
+ }
}
- }
- else {
+ } else {
gf_msg (this->name, GF_LOG_WARNING, 0,
DHT_MSG_NO_DISK_USAGE_STATUS, "no du stats ?!?");
}
@@ -1764,9 +1774,16 @@ dht_fix_layout_of_directory (call_frame_t *frame, loc_t *loc,
dht_layout_sort_volname (new_layout);
dht_selfheal_layout_new_directory (frame, loc, new_layout);
- /* Now selectively re-assign ranges only when it helps */
- dht_selfheal_layout_maximize_overlap (frame, loc, new_layout, layout);
+ /* Maximize overlap if weighted-rebalance is disabled */
+ if (!priv->do_weighting)
+ maximize_overlap = _gf_true;
+
+ /* Now selectively re-assign ranges only when it helps */
+ if (maximize_overlap) {
+ dht_selfheal_layout_maximize_overlap (frame, loc, new_layout,
+ layout);
+ }
done:
if (new_layout) {
/* Now that the new layout has all the proper layout, change the