diff options
author | Kotresh HR <khiremat@redhat.com> | 2016-08-05 09:03:22 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2016-08-25 14:39:38 -0700 |
commit | 0b3e4130b576c11156d6327e4cc3c9310a74c143 (patch) | |
tree | f0fe66209f2bbd778d34a80a531b8add9c6175bc /tests | |
parent | 218c9b033fa44eacbc27d87491abd830548b362e (diff) |
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 <vol name> scrub ondemand
Change-Id: I84c28904367eed827a7dae8d6a535c14b28e9f4d
BUG: 1366195
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Reviewed-on: http://review.gluster.org/15111
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Venky Shankar <vshankar@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bitrot/bug-1207627-bitrot-scrub-status.t | 20 | ||||
-rw-r--r-- | tests/volume.rc | 6 |
2 files changed, 24 insertions, 2 deletions
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; diff --git a/tests/volume.rc b/tests/volume.rc index cb63e327f9e..1b62c026a28 100644 --- a/tests/volume.rc +++ b/tests/volume.rc @@ -597,6 +597,12 @@ else fi } +function check_for_xattr { + local xattr=$1 + local filepath=$2 + getfattr -n $xattr $filepath 2>/dev/null | grep "$xattr" | cut -f1 -d'=' +} + function get_bitd_count { ps auxww | grep glusterfs | grep bitd.pid | grep -v grep | wc -l } |