From 2f287ccec79ac8c3b0d808da4db0d661c99fa856 Mon Sep 17 00:00:00 2001 From: Ashish Pandey Date: Tue, 20 Sep 2016 12:32:28 +0530 Subject: cluster/ec: Implement heal info with lock Problem: Currently heal info command prints all the files/directories if the index for the file/directory is present in .glusterfs/indices folder. After implementing patch http://review.gluster.org/#/c/13733/ indices of the file which is going through update fop will also be present in .glusterfs/indices even if the fop is successful on all the brick. At this time if heal info command is being used, it will also display this file which is actually healthy and does not require any heal. Solution: Take lock on a file corresponding to the indices and inspect xattrs to decide if the file needs heal or not. >Reviewed-on: http://review.gluster.org/15543 >NetBSD-regression: NetBSD Build System >Reviewed-by: Pranith Kumar Karampuri >Reviewed-by: Xavier Hernandez >CentOS-regression: Gluster Build System >Smoke: Gluster Build System >Signed-off-by: Ashish Pandey Change-Id: I6361e2813ece369be12d02e74816df4eddb81cfa BUG: 1383913 Signed-off-by: Ashish Pandey Reviewed-on: http://review.gluster.org/15627 Smoke: Gluster Build System CentOS-regression: Gluster Build System NetBSD-regression: NetBSD Build System Reviewed-by: Xavier Hernandez --- tests/afr.rc | 5 ----- tests/basic/ec/ec-background-heals.t | 4 +++- tests/volume.rc | 5 +++++ 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/afr.rc b/tests/afr.rc index ed376f0b41f..bdf4075a233 100644 --- a/tests/afr.rc +++ b/tests/afr.rc @@ -85,11 +85,6 @@ function is_file_heal_done { #count the number of entries marked for self-heal #in brick $1's index -function count_sh_entries() -{ - ls $1/.glusterfs/indices/xattrop | grep -v "xattrop-" | wc -l -} - function count_index_entries() { ls $1/.glusterfs/indices/xattrop | wc -l diff --git a/tests/basic/ec/ec-background-heals.t b/tests/basic/ec/ec-background-heals.t index 726e60d8fea..28efc83ebc9 100644 --- a/tests/basic/ec/ec-background-heals.t +++ b/tests/basic/ec/ec-background-heals.t @@ -23,6 +23,9 @@ EXPECT_WITHIN $CHILD_UP_TIMEOUT "3" ec_child_up_count $V0 0 EXPECT_WITHIN $CONFIG_UPDATE_TIMEOUT "0" mount_get_option_value $M0 $V0-disperse-0 background-heals EXPECT_WITHIN $CONFIG_UPDATE_TIMEOUT "0" mount_get_option_value $M0 $V0-disperse-0 heal-wait-qlength TEST touch $M0/a +EXPECT_WITHIN $HEAL_TIMEOUT "^0$" count_sh_entries $B0/${V0}0 +EXPECT_WITHIN $HEAL_TIMEOUT "^0$" count_sh_entries $B0/${V0}1 +EXPECT_WITHIN $HEAL_TIMEOUT "^0$" count_sh_entries $B0/${V0}2 TEST kill_brick $V0 $H0 $B0/${V0}2 echo abc > $M0/a EXPECT 2 get_pending_heal_count $V0 #One for each active brick @@ -30,7 +33,6 @@ $CLI volume start $V0 force EXPECT_WITHIN $CHILD_UP_TIMEOUT "3" ec_child_up_count $V0 0 #Accessing file shouldn't heal the file EXPECT "abc" cat $M0/a -sleep 3 EXPECT 2 get_pending_heal_count $V0 #One for each active brick TEST $CLI volume set $V0 disperse.background-heals 1 EXPECT_WITHIN $CONFIG_UPDATE_TIMEOUT "1" mount_get_option_value $M0 $V0-disperse-0 background-heals diff --git a/tests/volume.rc b/tests/volume.rc index aa614c50489..c8105567a38 100644 --- a/tests/volume.rc +++ b/tests/volume.rc @@ -704,3 +704,8 @@ function get_hard_link_count { local path=$1; stat -c %h $path } + +function count_sh_entries() +{ + ls $1/.glusterfs/indices/xattrop | grep -v "xattrop-" | wc -l +} -- cgit