Whamcloud - gitweb
LU-1816 scrub: OI scrub skips new created objects for once
[fs/lustre-release.git] / lustre / tests / sanity-scrub.sh
index 1ce2737..ea517ac 100644 (file)
@@ -675,6 +675,46 @@ test_10b() {
 }
 run_test 10b "non-stopped OI scrub should auto restarts after MDS remount (2)"
 
+test_11() {
+       echo "stopall"
+       stopall > /dev/null
+       echo "setupall"
+       setupall > /dev/null
+
+       local tname=`date +%s`
+       rm -rf $MOUNT/$tname > /dev/null
+       mkdir $MOUNT/$tname || error "(1) Fail to mkdir $MOUNT/$tname"
+
+       createmany -o $MOUNT/$tname/f 100 || error "(2) Fail to create!"
+
+       # reset OI scrub start point by force
+       $START_SCRUB -r || error "(3) Fail to start OI scrub!"
+       sleep 3
+       local STATUS=$($SHOW_SCRUB | awk '/^status/ { print $2 }')
+       [ "$STATUS" == "completed" ] ||
+               error "(4) Expect 'completed', but got '$STATUS'"
+
+       # OI scrub should skip the new created objects for the first accessing
+       local SKIPPED=$($SHOW_SCRUB | awk '/^noscrub/ { print $2 }')
+       [ $SKIPPED -eq 101 ] ||
+               error "(5) Expect 101 objects skipped, but got $SKIPPED"
+
+       # reset OI scrub start point by force
+       $START_SCRUB -r || error "(6) Fail to start OI scrub!"
+       sleep 3
+       STATUS=$($SHOW_SCRUB | awk '/^status/ { print $2 }')
+       [ "$STATUS" == "completed" ] ||
+               error "(7) Expect 'completed', but got '$STATUS'"
+
+       # OI scrub should skip the new created object only once
+       SKIPPED=$($SHOW_SCRUB | awk '/^noscrub/ { print $2 }')
+       [ $SKIPPED -eq 0 ] ||
+               error "(8) Expect 0 objects skipped, but got $SKIPPED"
+
+       rm -rf $MOUNT/$tname > /dev/null
+}
+run_test 11 "OI scrub skips the new created objects only once"
+
 # restore the ${facet}_MKFS_OPTS variables
 for facet in MGS MDS OST; do
        opts=SAVED_${facet}_MKFS_OPTS