summaryrefslogtreecommitdiffstats
path: root/tests/basic/ec
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2015-06-30 23:01:36 +0530
committerXavier Hernandez <xhernandez@datalab.es>2015-07-06 03:31:27 -0700
commitc6742adc98a9747f5e16c242aaddc28ea991ec5a (patch)
tree5992ccf21d5fa5a35b2935e2f169d202aafb54f9 /tests/basic/ec
parent214101394bdea4ab57b8704467f450df4adbb8f6 (diff)
cluster/ec: Make background healing optional behavior
Provide options to control number of active background heal count and qlen. Change-Id: Idc2419219d881f47e7d2e9bbc1dcdd999b372033 BUG: 1237381 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/11473 Reviewed-by: Xavier Hernandez <xhernandez@datalab.es> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'tests/basic/ec')
-rw-r--r--tests/basic/ec/ec-background-heals.t100
1 files changed, 100 insertions, 0 deletions
diff --git a/tests/basic/ec/ec-background-heals.t b/tests/basic/ec/ec-background-heals.t
new file mode 100644
index 00000000000..e0fa3a1e3b2
--- /dev/null
+++ b/tests/basic/ec/ec-background-heals.t
@@ -0,0 +1,100 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+
+# This test checks background heals option
+
+cleanup
+TEST glusterd
+TEST pidof glusterd
+TEST $CLI volume create $V0 disperse 3 redundancy 1 $H0:$B0/${V0}{0..2}
+TEST $CLI volume heal $V0 disable
+TEST $CLI volume set $V0 performance.stat-prefetch off
+TEST $CLI volume set $V0 performance.write-behind off
+TEST $CLI volume set $V0 performance.quick-read off
+TEST $CLI volume set $V0 performance.read-ahead off
+TEST $CLI volume set $V0 performance.io-cache off
+TEST $CLI volume set $V0 disperse.background-heals 0
+TEST $CLI volume start $V0
+
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0;
+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
+TEST kill_brick $V0 $H0 $B0/${V0}2
+echo abc > $M0/a
+EXPECT 2 get_pending_heal_count $V0 #One for each active brick
+$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
+EXPECT_WITHIN $CONFIG_UPDATE_TIMEOUT "128" mount_get_option_value $M0 $V0-disperse-0 heal-wait-qlength
+#Accessing file should heal the file now
+EXPECT "abc" cat $M0/a
+EXPECT_WITHIN $HEAL_TIMEOUT 0 get_pending_heal_count $V0
+
+#Test above test cases with reset instead of setting background-heals to 1
+TEST $CLI volume set $V0 disperse.heal-wait-qlength 1024
+EXPECT_WITHIN $CONFIG_UPDATE_TIMEOUT "1" mount_get_option_value $M0 $V0-disperse-0 background-heals
+EXPECT_WITHIN $CONFIG_UPDATE_TIMEOUT "1024" mount_get_option_value $M0 $V0-disperse-0 heal-wait-qlength
+TEST $CLI volume set $V0 disperse.background-heals 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 $CLI volume set $V0 disperse.heal-wait-qlength 200 #Changing qlength shouldn't affect anything now
+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 kill_brick $V0 $H0 $B0/${V0}2
+echo abc > $M0/a
+EXPECT 2 get_pending_heal_count $V0 #One for each active brick
+$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 reset $V0 disperse.background-heals
+EXPECT_WITHIN $CONFIG_UPDATE_TIMEOUT "8" mount_get_option_value $M0 $V0-disperse-0 background-heals
+EXPECT_WITHIN $CONFIG_UPDATE_TIMEOUT "200" mount_get_option_value $M0 $V0-disperse-0 heal-wait-qlength
+#Accessing file should heal the file now
+EXPECT "abc" cat $M0/a
+EXPECT_WITHIN $HEAL_TIMEOUT 0 get_pending_heal_count $V0
+
+#Test that disabling background-heals still drains the queue
+TEST $CLI volume set $V0 disperse.background-heals 1
+TEST touch $M0/{a,b,c,d}
+TEST kill_brick $V0 $H0 $B0/${V0}2
+EXPECT_WITHIN $CONFIG_UPDATE_TIMEOUT "1" mount_get_option_value $M0 $V0-disperse-0 background-heals
+EXPECT_WITHIN $CONFIG_UPDATE_TIMEOUT "200" mount_get_option_value $M0 $V0-disperse-0 heal-wait-qlength
+TEST truncate -s 1GB $M0/a
+echo abc > $M0/b
+echo abc > $M0/c
+echo abc > $M0/d
+TEST $CLI volume start $V0 force
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "3" ec_child_up_count $V0 0
+TEST chown root:root $M0/{a,b,c,d}
+TEST $CLI volume set $V0 disperse.background-heals 0
+EXPECT_NOT "0" mount_get_option_value $M0 $V0-disperse-0 heal-waiters
+TEST truncate -s 0 $M0/a # This completes the heal fast ;-)
+EXPECT_WITHIN $HEAL_TIMEOUT 0 get_pending_heal_count $V0
+
+#Test that background heals get rejected on meeting background-qlen limit
+TEST $CLI volume set $V0 disperse.background-heals 1
+TEST $CLI volume set $V0 disperse.heal-wait-qlength 0
+TEST kill_brick $V0 $H0 $B0/${V0}2
+EXPECT_WITHIN $CONFIG_UPDATE_TIMEOUT "1" 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 truncate -s 1GB $M0/a
+echo abc > $M0/b
+echo abc > $M0/c
+echo abc > $M0/d
+TEST $CLI volume start $V0 force
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "3" ec_child_up_count $V0 0
+TEST chown root:root $M0/{a,b,c,d}
+EXPECT "0" mount_get_option_value $M0 $V0-disperse-0 heal-waiters
+cleanup