From 181d7bafb4da76401c3a1eb30bfdfbe8239968ab Mon Sep 17 00:00:00 2001 From: N Balachandran Date: Wed, 16 Aug 2017 12:58:52 +0530 Subject: cluster/dht: Reorder dir operations in gf_defrag_fix_layout Earlier, rebalance performed a fix-layout on a directory before healing its subdirectories. If there were a lot of subdirs, it could take a while before all subdirs were created on the newly added bricks. As dht_readdirp only lists dirs from their hashed subvol, those dirs which hashed to the newly added bricks but were not yet created on them were not listed. Now, the child dirs are listed and processed before the layout of the parent is fixed. This introduces a change in behaviour where files in subdirs are migrated before those in parent directories. Credit: Shyam Github issue: #239 > BUG: 1248393 > Signed-off-by: N Balachandran > Reviewed-on: https://review.gluster.org/18045 > Smoke: Gluster Build System > CentOS-regression: Gluster Build System > Reviewed-by: Raghavendra G (cherry picked from commit 96b33b4b278391ca8a7755cf274931d4f1808cb5) Change-Id: I8ae7f24a510754cd8d1b31e5d608bcf1928599e2 BUG: 1483402 Signed-off-by: N Balachandran Reviewed-on: https://review.gluster.org/18071 Smoke: Gluster Build System Reviewed-by: Raghavendra G CentOS-regression: Gluster Build System --- tests/features/trash.t | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/features/trash.t b/tests/features/trash.t index 620b84f0da1..472e909e567 100755 --- a/tests/features/trash.t +++ b/tests/features/trash.t @@ -2,6 +2,7 @@ . $(dirname $0)/../include.rc . $(dirname $0)/../volume.rc +. $(dirname $0)/../dht.rc cleanup @@ -183,13 +184,20 @@ TEST file_exists $V0 rebal1 rebal2 TEST $CLI volume add-brick $V0 $H0:$B0/${V0}3 TEST [ -d $B0/${V0}3 ] + # perform rebalance [36] TEST $CLI volume rebalance $V0 start force +EXPECT_WITHIN $REBALANCE_TIMEOUT "0" rebalance_completed + +#Find out which file was migrated to the new brick +file_name=$(ls $B0/${V0}3/rebal*| xargs basename) # check whether rebalance was succesful [37-40] -EXPECT_WITHIN $REBALANCE_TIMEOUT "Y" wildcard_exists $B0/${V0}3/rebal2 -EXPECT_WITHIN $REBALANCE_TIMEOUT "Y" wildcard_exists $B0/${V0}1/.trashcan/internal_op/rebal2* +EXPECT "Y" wildcard_exists $B0/${V0}3/$file_name* +EXPECT "Y" wildcard_exists $B0/${V0}1/.trashcan/internal_op/$file_name* + EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 + # force required in case rebalance is not over TEST $CLI volume stop $V0 force @@ -236,7 +244,7 @@ EXPECT_WITHIN $HEAL_TIMEOUT "Y" wildcard_exists $B0/${V1}1/.trashcan/internal_op TEST $CLI volume set $V0 trash-dir abc TEST start_vol $V0 $M0 $M0/abc TEST [ -e $M0/abc -a ! -e $M0/.trashcan ] -EXPECT "Y" wildcard_exists $B0/${V0}1/abc/internal_op/rebal2* +EXPECT "Y" wildcard_exists $B0/${V0}1/abc/internal_op/rebal* # ensure that rename and delete operation on trash directory fails [63-65] rm -rf $M0/abc/internal_op -- cgit