From 0b3e4130b576c11156d6327e4cc3c9310a74c143 Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Fri, 5 Aug 2016 09:03:22 +0530 Subject: feature/bitrot: Ondemand scrub option for bitrot The bitrot scrubber takes 'hourly/daily/biweekly/monthly' as the values for 'scrub-frequency'. There is no way to schedule the scrubbing when the admin wants it. Ondemand scrubbing brings in the new option 'ondemand' with which the admin can start scrubbing ondemand. It starts the scrubbing immediately. Ondemand scrubbing is successful only if the scrubber is in 'Active (Idle)' (waiting for it's next frequency cycle to start scrubbing). It is not entertained when the scrubber is in 'Paused' or already running. Here is the command line syntax. gluster volume bitrot scrub ondemand Change-Id: I84c28904367eed827a7dae8d6a535c14b28e9f4d BUG: 1366195 Signed-off-by: Kotresh HR Reviewed-on: http://review.gluster.org/15111 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Venky Shankar --- tests/bitrot/bug-1207627-bitrot-scrub-status.t | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'tests/bitrot') diff --git a/tests/bitrot/bug-1207627-bitrot-scrub-status.t b/tests/bitrot/bug-1207627-bitrot-scrub-status.t index bca3919e2ac..a361986fdaf 100644 --- a/tests/bitrot/bug-1207627-bitrot-scrub-status.t +++ b/tests/bitrot/bug-1207627-bitrot-scrub-status.t @@ -12,7 +12,7 @@ TEST glusterd; TEST pidof glusterd; ## Lets create and start the volume -TEST $CLI volume create $V0 $H0:$B0/${V0}{1..2} +TEST $CLI volume create $V0 $H0:$B0/${V0}1 TEST $CLI volume start $V0 ## Enable bitrot for volume $V0 @@ -26,11 +26,27 @@ TEST $CLI volume bitrot $V0 scrub-frequency hourly ## Setting scrubber throttle value lazy TEST $CLI volume bitrot $V0 scrub-throttle lazy - EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'Active' scrub_status $V0 'State of scrub' EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'lazy' scrub_status $V0 'Scrub impact' EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'hourly' scrub_status $V0 'Scrub frequency' EXPECT_WITHIN $PROCESS_UP_TIMEOUT '/var/log/glusterfs/bitd.log' scrub_status $V0 'Bitrot error log location' EXPECT_WITHIN $PROCESS_UP_TIMEOUT '/var/log/glusterfs/scrub.log' scrub_status $V0 'Scrubber error log location' +## Set expiry-timeout to 1 sec +TEST $CLI volume set $V0 features.expiry-time 1 + +##Mount $V0 +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0 + +#Create sample file +TEST `echo "1234" > $M0/FILE1` +EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'trusted.bit-rot.signature' check_for_xattr 'trusted.bit-rot.signature' "/$B0/${V0}1/FILE1" + +##Corrupt the file +TEST `echo "corrupt" >> /$B0/${V0}1/FILE1` + +## Ondemand scrub +TEST $CLI volume bitrot $V0 scrub ondemand +EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'trusted.bit-rot.bad-file' check_for_xattr 'trusted.bit-rot.bad-file' "/$B0/${V0}1/FILE1" + cleanup; -- cgit