Whamcloud - gitweb
EX-2745 tests: reduce file size for hot-pools.sh test 56
authorJian Yu <yujian@whamcloud.com>
Thu, 11 Mar 2021 06:21:56 +0000 (22:21 -0800)
committerAndreas Dilger <adilger@whamcloud.com>
Thu, 18 Mar 2021 15:45:14 +0000 (15:45 +0000)
This patch reduces the file size for hot-pools.sh test 56
by adjusting lpurge freelo and freehi options so as to
trigger lpurge after writing files with smaller size.

Test-Parameters: trivial testlist=hot-pools,hot-pools \
serverextra_install_params="--lipe-job lipe --lipe-build 0 -k zfs"

Test-Parameters: trivial testgroup=review-dne-part-2 \
serverextra_install_params="--lipe-job lipe --lipe-build 0 -k zfs"

Change-Id: I15c3a11e6453ec24d11c188ae82a980587259e80
Signed-off-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
Reviewed-by: James Nunez <jnunez@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/42027
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/tests/hot-pools.sh

index 99a570e..920da75 100644 (file)
@@ -12,8 +12,8 @@ init_test_env $@
 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 init_logging
 
-# bug number for skipped test:   EX-2745/EX-2757
-ALWAYS_EXCEPT="$HOT_POOLS_EXCEPT 56"
+# bug number for skipped test:
+ALWAYS_EXCEPT="$HOT_POOLS_EXCEPT "
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
 (( OSTCOUNT >= 2 )) || skip_env "need at least 2 OSTs"
@@ -875,6 +875,23 @@ verify_lpurge_params() {
        done
 }
 
+wait_file_resync() {
+       local file="$1"
+       local max=${2:-900}
+       local i
+
+       for ((i = 0; i < $max; i++)); do
+               grep -q 'lcme_flags:.*stale' <<< $($LFS getstripe $file) ||
+                       break
+               sleep 1
+       done
+
+       (( i < max )) || {
+               $LFS getstripe $file
+               error "$file still has stale component after $i seconds"
+       }
+}
+
 wait_file_mirror() {
        local file="$1"
        local count="$2"
@@ -1592,9 +1609,12 @@ test_56() {
        local tf=$DIR/$tfile
        local free_MB
        local size_MB
+       local freehi=99
+       local freelo=96
        local cksum_orig
        local cksum_new
        local ids
+       local cmd
        local i
 
        init_hot_pools_env
@@ -1605,65 +1625,75 @@ test_56() {
        stack_trap stop_lamigo_service
 
        # start lpurge
-       LPURGE_FREELO=80 start_lpurge_service
+       LPURGE_FREELO=$freelo LPURGE_FREEHI=$freehi start_lpurge_service
        check_lpurge_is_started || error "failed to start lpurge"
        stack_trap stop_lpurge_service
 
        $LFS df
        free_MB=$(($(df -P $DIR | tail -n 1 | awk '{ print $4 }') / 1024))
-       size_MB=$((free_MB / 2 / 4))
+       size_MB=$((free_MB * (100 - freelo + 1) / 100 / 2))
 
        # create a regular file in source pool
-       $LFS setstripe -c -1 -p $LAMIGO_SRC $tf-1 ||
-               error "$LFS setstripe $tf-1 failed"
+       cmd="$LFS setstripe -c -1 -p $LAMIGO_SRC $tf-1"
+       echo $cmd
+       $cmd || error "$LFS setstripe $tf-1 failed"
 
        # create a PFL file
-       $LFS setstripe -E 1M -c -1 -p $LAMIGO_SRC --comp-flags=prefer \
-                      -E eof -p $LAMIGO_TGT $tf-2 ||
-                               error "$LFS setstripe $tf-2 failed"
+       cmd="$LFS setstripe -E 1M -c -1 -p $LAMIGO_SRC --comp-flags=prefer"
+       cmd+=" -E eof -p $LAMIGO_TGT $tf-2"
+       echo $cmd
+       $cmd || error "$LFS setstripe $tf-2 failed"
 
        # create a FLR file
-       $LFS mirror create -N -E 1M -c -1 -p $LAMIGO_SRC -E eof -p $LAMIGO_TGT \
-                          -N -p $LAMIGO_SRC $tf-3 ||
-                               error "$LFS setstripe $tf-3 failed"
+       cmd="$LFS mirror create -N -E 1M -c -1 -p $LAMIGO_SRC"
+       cmd+=" -E eof -p $LAMIGO_TGT -N -p $LAMIGO_SRC $tf-3"
+       echo $cmd
+       $cmd || error "$LFS setstripe $tf-3 failed"
+
        # fill in data
-       for i in $(seq 2); do
-               yes "${size_MB}M file"|
-                       dd bs=1M count=$size_MB iflag=fullblock of=$tf-$i ||
-                               error "failed to write to $tf-$i"
-       done
        yes "1M file"| dd bs=1M count=1 iflag=fullblock of=$tf-3 ||
                error "failed to write to $tf-3"
        cancel_lru_locks
        sync; sleep 5; sync
        $LFS mirror resync $tf-3 || error "failed to resync $tf-3"
+
+       for i in {1..2}; do
+               yes "${size_MB}M file"|
+                       dd bs=1M count=$size_MB iflag=fullblock of=$tf-$i || {
+                               $LFS getstripe $tf-$i
+                               error "failed to write to $tf-$i"
+                       }
+       done
+
        cancel_lru_locks osc
        echo "Before replicating and purging:"
        $LFS df
 
        # compute checksums if file size is equal to or smaller than 2GB
-       if (( size_MB <= 2048 )); then
-               echo "Compute checksums ..."
-               for i in $(seq 3); do
-                       cksum_orig[${#cksum_orig[@]}]=$(md5sum $tf-$i)
-               done
-       fi
+       echo "Compute checksums ..."
+       for i in {1..3}; do
+               ! (( i < 3 && size_MB > 2048 )) || continue
+               cksum_orig[${#cksum_orig[@]}]=$(md5sum $tf-$i)
+       done
 
        sleep $((LAMIGO_AGE * 2 + LPURGE_INTV * 2))
 
+       for i in {1..3}; do
+               wait_file_resync $tf-$i
+       done
+
        echo "After replicating and purging:"
        $LFS df
 
        # check checksums if file size is equal to or smaller than 2GB
-       if (( size_MB <= 2048 )); then
-               echo "Check checksums ..."
-               for i in $(seq 3); do
-                       cksum_new[${#cksum_new[@]}]=$(md5sum $tf-$i)
-
-                       [[ "${cksum_orig[i-1]}" = "${cksum_new[i-1]}" ]] ||
-                               error "$tf-$i checksum mismatch: '${cksum_orig[i-1]}' != '${cksum_new[i-1]}'"
-               done
-       fi
+       echo "Check checksums ..."
+       for i in {1..3}; do
+               ! (( i < 3 && size_MB > 2048 )) || continue
+               cksum_new[${#cksum_new[@]}]=$(md5sum $tf-$i)
+
+               [[ "${cksum_orig[i-1]}" = "${cksum_new[i-1]}" ]] ||
+                       error "$tf-$i checksum mismatch: '${cksum_orig[i-1]}' != '${cksum_new[i-1]}'"
+       done
 
        # verify files replicated in target pool and purged from source pool
        wait_file_mirror $tf-1 1 900