Whamcloud - gitweb
EX-8981 csdc: execute tests if compression is enabled
authorArtem Blagodarenko <ablagodarenko@ddn.com>
Tue, 20 Feb 2024 00:13:28 +0000 (00:13 +0000)
committerAndreas Dilger <adilger@whamcloud.com>
Sat, 30 Mar 2024 07:20:04 +0000 (07:20 +0000)
"csdc: Provide finer grained enable_compression control" patch
enables CSDC by default on all archs except aarch64 and ppc64le.
No need to execute enable_compression/disable_compression for
each test, so this test changes them to compression_enabled
check that skips test if compression is disabled for the arch.

This patch forces to skip compression tests for ppc64le and
aarch64 so they stop adding noise to the test results.

Test-Parameters: testlist=sanity-compr env=SANITY_ONLY="460",ONLY="0 1001-1080" serverversion=2.15
Test-Parameters: testlist=hot-pools env=ONLY=80 serverversion=2.15
Test-Parameters: testlist=sanity-flr env=ONLY=43 serverversion=2.15
Test-Parameters: testlist=sanity-sec env=ONLY="66 67" serverversion=2.15
Signed-off-by: Artem Blagodarenko <ablagodarenko@ddn.com>
Change-Id: I2b5deba0672f3bad028f383cf1205e66c2b05529
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/54105
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/tests/hot-pools.sh
lustre/tests/sanity-compr.sh
lustre/tests/sanity-flr.sh
lustre/tests/sanity-sec.sh
lustre/tests/sanity.sh
lustre/tests/test-framework.sh

index 65191af..b69307e 100755 (executable)
@@ -2693,8 +2693,8 @@ test_80() {
 
        init_hot_pools_env
 
-       enable_compression
-       stack_trap "rm -fr $file; disable_compression"
+       stack_trap "rm -fr $file"
+       compression_enabled || skip "compression is disabled ($(uname -a))"
 
        LAMIGO_AGT_NODES="" \
        LAMIGO_CLIENTS=$client \
index 9134242..5768bb9 100644 (file)
@@ -23,7 +23,7 @@ FAIL_ON_ERROR=false
 check_and_setup_lustre
 
 (( $MDS1_VERSION >= $(version_code 2.14.0-ddn93) )) ||
-       skip "need MDS >= 2.14.0-ddn93 for layout support"
+       skip "need MDS >= 2.14.0-ddn93 for compress layout support"
 
 # $RUNAS_ID may get set incorrectly somewhere else
 if [[ $UID -eq 0 && $RUNAS_ID -eq 0 ]]; then
@@ -82,6 +82,16 @@ test_0b() {
        local types_save=($(do_facet mds1 \
                            $LCTL get_param -n mdt.*.compress_types))
 
+       if [[ -z $(do_facet mds1 "$LCTL get_param mdt.*.compress_types") ]] &&
+          (( $MDS1_VERSION > $(version_code 2.14.0-ddn128-6-g70133e8f) ||
+             $MDS1_VERSION < $(version_code 2.14.0-ddn88-4-g0d1831c9e) )); then
+               # Test compressed *cannot* be created if MDS has no support.
+               # The above checks exclude MDS versions where CSDC *layout* was
+               # accepted, but before connect flag was added (compress_types).
+               $LFS setstripe -E eof -c 1 -Z lzo $DIR/$tfile &&
+                       error "able to create file without compression"
+       fi
+
        skip "MDT support for compression connect flags is disabled for now"
 
        [[ -n "$types_save" ]] || skip "no MDT support for compress_types"
@@ -126,8 +136,8 @@ test_1a() {
                skip "need MDS > 2.14.0-ddn131-15-g3e1dd9d6ae for comp add"
 
        local tf=$DIR/$tfile
-       stack_trap "rm -f $tf; disable_compression"
-       enable_compression
+       stack_trap "rm -f $tf"
+       compression_enabled || skip "compression is disabled ($(uname -a))"
 
        $LFS setstripe -E1M $tf || error "setstripe failed"
        $LFS setstripe -Eeof --component-add -Z gzip $tf ||
@@ -300,8 +310,8 @@ test_1001() {
        # Source should be a few MiB in size
        $CHECKSTAT -s 14625450 $source || error "checkstat wrong size"
 
-       stack_trap "rm -f $tf; disable_compression"
-       enable_compression
+       stack_trap "rm -f $tf"
+       compression_enabled || skip "compression is disabled ($(uname -a))"
 
        # Simple compressed layout
 
@@ -394,8 +404,8 @@ test_1002() {
        # Source should be a few MiB in size
        $CHECKSTAT -s 14625450 $source || error "checkstat wrong size"
 
-       stack_trap "rm -f $tf; disable_compression"
-       enable_compression
+       stack_trap "rm -f $tf"
+       compression_enabled || skip "compression is disabled ($(uname -a))"
 
        # Disable readahead so reads are not expanded to full chinks
        $LCTL set_param osc.*.rpc_stats=c
@@ -522,8 +532,8 @@ test_1003() {
        # Source should be a few MiB in size
        $CHECKSTAT -s 14625450 $source || error "checkstat wrong size"
 
-       stack_trap "rm -f $tf; disable_compression"
-       enable_compression
+       stack_trap "rm -f $tf"
+       compression_enabled || skip "compression is disabled ($(uname -a))"
 
        local chunksizes=(
                64
@@ -630,8 +640,8 @@ test_1004() {
        # Source should be a few MiB in size
        $CHECKSTAT -s 14625450 $tmp_hdf || error "checkstat wrong size"
 
-       stack_trap "rm -f $tf; disable_compression"
-       enable_compression
+       stack_trap "rm -f $tf"
+       compression_enabled || skip "compression is disabled ($(uname -a))"
 
        # Simple compressed layout
        $LFS setstripe -E -1 -Z lz4:0 --compress-chunk=$chunksize $tf ||
@@ -724,8 +734,8 @@ test_1005() {
        # Source should be a few MiB in size
        $CHECKSTAT -s 14625450 $source || error "checkstat wrong size"
 
-       stack_trap "rm -f $tf; disable_compression"
-       enable_compression
+       stack_trap "rm -f $tf"
+       compression_enabled || skip "compression is disabled ($(uname -a))"
 
        # Disable readahead so reads are not expanded to full chinks
        $LCTL set_param osc.*.rpc_stats=c
@@ -909,8 +919,8 @@ test_1006() {
        # Source should be a few MiB in size
        $CHECKSTAT -s 14625450 $source || error "checkstat wrong size"
 
-       stack_trap "rm -f $tf; disable_compression"
-       enable_compression
+       stack_trap "rm -f $tf"
+       compression_enabled || skip "compression is disabled ($(uname -a))"
 
        $LFS setstripe -E -1 -Z lz4:0 --compress-chunk=$chunksize $tf.source ||
                error "set a compress component in $tf.source failed"
@@ -1015,8 +1025,8 @@ test_1007() {
        # Source should be a few MiB in size
        $CHECKSTAT -s 14625450 $source || error "checkstat wrong size"
 
-       stack_trap "rm -f $tf; disable_compression"
-       enable_compression
+       stack_trap "rm -f $tf"
+       compression_enabled || skip "compression is disabled ($(uname -a))"
 
        for compr_type in ${compr_types[@]}; do
        for compr_level in ${compr_levels[@]}; do
@@ -1133,8 +1143,8 @@ test_1008() {
        local td=$DIR/$tdir
        local source="/etc/ /bin/"
 
-       stack_trap "rm -rf $td; disable_compression"
-       enable_compression
+       stack_trap "rm -rf $td"
+       compression_enabled || skip "compression is disabled ($(uname -a))"
 
        for compr_type in ${compr_types[@]}; do
        for compr_level in ${compr_levels[@]}; do
@@ -1213,6 +1223,92 @@ test_1008() {
 }
 run_test 1008 "validate directory space usage reduction with compression"
 
+test_1020() {
+       (( MDS1_VERSION >= $(version_code 2.14.0-ddn128) )) ||
+               skip "Need MDS version at least 2.14.0-ddn128"
+
+       test_mkdir -p $DIR/$tdir
+       local tf=$DIR/$tdir/$tfile
+       local hdf=$LUSTRE/tests/AMSR_E_L3_DailyOcean_V05_20111003.hdf
+       local tmp_hdf=$TMP/$tfile.hdf
+       local source=$tmp_hdf
+       local chunksize=128
+       local wb_compr=0        # write_bytes_compr
+       local wb_raw=0          # write_bytes_raw
+       local w_chunks=0        # write_chunks_compr
+       local rb_raw=0          # read_bytes_raw
+       local rb_compr=0        # read_bytes_compr
+       local r_chunks=0        # read_chunks_compr
+
+       # clear counters
+       lctl set_param osc.*.stats_compr 0
+
+       if [[ -f $hdf.bz2 ]] && type -p bzcat >/dev/null; then
+               bzcat $hdf.bz2 > $tmp_hdf
+       elif [[ -f $hdf.bz2 ]] && type -p bunzip2 >/dev/null; then
+               cp $hdf.bz2 $tmp_hdf.bz2 || error "cp $tmp_hdf.bz2"
+               bunzip2 $tmp_hdf.bz2 || error "bunzip2 $tmp_hdf.bz2"
+       else
+               skip_env "bunzip2 is not installed"
+       fi
+
+       compression_enabled || skip "compression is disabled ($(uname -a))"
+
+       lctl set_param debug=sec debug_mb=256
+
+       # Disable readahead so reads are not expanded to full chinks
+       $LCTL set_param osc.*.rpc_stats=c
+       read_ahead_mb=$($LCTL get_param -n llite.*.max_read_ahead_mb)
+       $LCTL set_param llite.*.max_read_ahead_mb=0
+       stack_trap "$LCTL set_param llite.*.max_read_ahead_mb=$read_ahead_mb" EXIT
+
+
+       # Simple compressed layout + (OST-0000 and stripe_count == 1)
+       $LFS setstripe -i 0 -c 1 -E -1 \
+                      -Z lz4:0 --compress-chunk=$chunksize $DIR/$tdir ||
+                      error "set a compress component in $DIR/$tdir failed"
+
+       cp -a $source $tf || error "copy $hdf to $tf failed"
+       sync
+       cancel_lru_locks osc
+
+       wb_compr=$(lctl get_param osc.$FSNAME-OST0000*.stats_compr |
+                  awk '/write_bytes_compr:/ { print $2 }')
+
+       wb_raw=$(lctl get_param osc.$FSNAME-OST0000*.stats_compr |
+                awk '/write_bytes_raw:/ { print $2 }')
+
+       w_chunks=$(lctl get_param osc.$FSNAME-OST0000*.stats_compr |
+                  awk '/write_chunks_compr:/ { print $2 }')
+
+       dd if=$tf of=/dev/null bs=1M || error "read $tf via dd failed"
+
+       rb_compr=$(lctl get_param osc.$FSNAME-OST0000*.stats_compr |
+                  awk '/read_bytes_compr:/ { print $2 }')
+
+       rb_raw=$(lctl get_param osc.$FSNAME-OST0000*.stats_compr |
+                awk '/read_bytes_raw:/ { print $2 }')
+
+       r_chunks=$(lctl get_param osc.$FSNAME-OST0000*.stats_compr |
+                  awk '/read_chunks_compr:/ { print $2 }')
+
+       # Print stats for debug
+       du --block-size=1 $tf
+       lctl get_param osc.$FSNAME-OST0000*.stats_compr
+
+       # Uncomment the check after adding the server part.
+       # (( rb_compr == wb_compr )) ||
+       #       error "compr size does not match. '$rb_compr' != '$wb_compr'"
+
+       (( rb_raw == wb_raw )) ||
+               error "original size does not match. '$rb_raw' != '$wb_raw'"
+
+       # Uncomment the check after adding the server part.
+       # (( r_chunks == w_chunks )) ||
+       #       error "num of chunks does not match. '$r_chunks' != '$w_chunks'"
+}
+run_test 1020 "Сhecking compression counters"
+
 test_1080() {
        (( MDS1_VERSION >= $(version_code 2.14.0-ddn128) )) ||
                skip "Need MDS version at least 2.14.0-ddn128"
@@ -1223,7 +1319,7 @@ test_1080() {
        local compressed=$LUSTRE/tests/compressed.bin
        local broken_header=$TMP/$tfile.4
 
-       enable_compression
+       compression_enabled || skip "compression is disabled ($(uname -a))"
        # Use pre-created compressed file
        hexdump -C $compressed | head
        cat $compressed > $tf
@@ -1309,93 +1405,6 @@ test_1080() {
 }
 run_test 1080 "Compression header error tolerance"
 
-test_1020() {
-       (( MDS1_VERSION >= $(version_code 2.14.0-ddn128) )) ||
-               skip "Need MDS version at least 2.14.0-ddn128"
-
-       test_mkdir -p $DIR/$tdir
-       local tf=$DIR/$tdir/$tfile
-       local hdf=$LUSTRE/tests/AMSR_E_L3_DailyOcean_V05_20111003.hdf
-       local tmp_hdf=$TMP/$tfile.hdf
-       local source=$tmp_hdf
-       local chunksize=128
-       local wb_compr=0        # write_bytes_compr
-       local wb_raw=0          # write_bytes_raw
-       local w_chunks=0        # write_chunks_compr
-       local rb_raw=0          # read_bytes_raw
-       local rb_compr=0        # read_bytes_compr
-       local r_chunks=0        # read_chunks_compr
-
-       # clear counters
-       lctl set_param osc.*.stats_compr 0
-
-       if [[ -f $hdf.bz2 ]] && type -p bzcat >/dev/null; then
-               bzcat $hdf.bz2 > $tmp_hdf
-       elif [[ -f $hdf.bz2 ]] && type -p bunzip2 >/dev/null; then
-               cp $hdf.bz2 $tmp_hdf.bz2 || error "cp $tmp_hdf.bz2"
-               bunzip2 $tmp_hdf.bz2 || error "bunzip2 $tmp_hdf.bz2"
-       else
-               skip_env "bunzip2 is not installed"
-       fi
-
-       stack_trap "rm -f $tf; disable_compression"
-       enable_compression
-
-       lctl set_param debug=sec debug_mb=256
-
-       # Disable readahead so reads are not expanded to full chinks
-       $LCTL set_param osc.*.rpc_stats=c
-       read_ahead_mb=$($LCTL get_param -n llite.*.max_read_ahead_mb)
-       $LCTL set_param llite.*.max_read_ahead_mb=0
-       stack_trap "$LCTL set_param llite.*.max_read_ahead_mb=$read_ahead_mb" EXIT
-
-
-       # Simple compressed layout + (OST-0000 and stripe_count == 1)
-       $LFS setstripe -i 0 -c 1 -E -1 \
-                      -Z lz4:0 --compress-chunk=$chunksize $DIR/$tdir ||
-                      error "set a compress component in $DIR/$tdir failed"
-
-       cp -a $source $tf || error "copy $hdf to $tf failed"
-       sync
-       cancel_lru_locks osc
-
-       wb_compr=$(lctl get_param osc.$FSNAME-OST0000*.stats_compr |
-                  awk '/write_bytes_compr:/ { print $2 }')
-
-       wb_raw=$(lctl get_param osc.$FSNAME-OST0000*.stats_compr |
-                awk '/write_bytes_raw:/ { print $2 }')
-
-       w_chunks=$(lctl get_param osc.$FSNAME-OST0000*.stats_compr |
-                  awk '/write_chunks_compr:/ { print $2 }')
-
-       dd if=$tf of=/dev/null bs=1M || error "read $tf via dd failed"
-
-       rb_compr=$(lctl get_param osc.$FSNAME-OST0000*.stats_compr |
-                  awk '/read_bytes_compr:/ { print $2 }')
-
-       rb_raw=$(lctl get_param osc.$FSNAME-OST0000*.stats_compr |
-                awk '/read_bytes_raw:/ { print $2 }')
-
-       r_chunks=$(lctl get_param osc.$FSNAME-OST0000*.stats_compr |
-                  awk '/read_chunks_compr:/ { print $2 }')
-
-       # Print stats for debug
-       du --block-size=1 $tf
-       lctl get_param osc.$FSNAME-OST0000*.stats_compr
-
-       # Uncomment the check after adding the server part.
-       # (( rb_compr == wb_compr )) ||
-       #       error "compr size does not match. '$rb_compr' != '$wb_compr'"
-
-       (( rb_raw == wb_raw )) ||
-               error "original size does not match. '$rb_raw' != '$wb_raw'"
-
-       # Uncomment the check after adding the server part.
-       # (( r_chunks == w_chunks )) ||
-       #       error "num of chunks does not match. '$r_chunks' != '$w_chunks'"
-}
-run_test 1020 "Сhecking compression counters"
-
 complete_test $SECONDS
 check_and_cleanup_lustre
 declare -a logs=($ONLY)
index f4bae2d..5ec9be8 100644 (file)
@@ -2075,10 +2075,8 @@ test_43b() {
 }
 run_test 43b "allow writing to multiple preferred mirror file"
 
-export LFS_SETSTRIPE_COMPR_OK="yes"
 test_43c() {
-       (( $MDS1_VERSION >= $(version_code 2.14.0.88) )) ||
-               skip "Need MDS >= 2.14.0.88 for compression support"
+       compression_enabled || skip "compression is disabled ($(uname -a))"
 
        local tf=$DIR/$tdir/$tfile
        local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
@@ -2104,8 +2102,7 @@ test_43c() {
 run_test 43c "read prefer uncompressed mirror"
 
 test_43d() {
-       (( $MDS1_VERSION >= $(version_code 2.14.0.88) )) ||
-               skip "Need MDS >= 2.14.0.88 for compression support"
+       compression_enabled || skip "compression is disabled ($(uname -a))"
 
        local tf=$DIR/$tdir/$tfile
        local flags
@@ -2138,7 +2135,6 @@ test_43d() {
        verify_comp_attr lcme_flags $tf 0x20002 init,stale,compress
 }
 run_test 43d "prefer write on uncompressed mirror"
-export LFS_SETSTRIPE_COMPR_OK=""
 
 test_44a() {
        [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
index 54490e1..88248a1 100755 (executable)
@@ -6173,8 +6173,7 @@ test_66() {
        local tmpfile=$TMP/$tfile
        local resfile=$TMP/resfile
 
-       (( MDS1_VERSION >= $(version_code 2.14.0.101) )) ||
-               skip "Need MDS >= 2.14.0.101 for compression support"
+       compression_enabled || skip "compression is disabled ($(uname -a))"
 
        cli_enc=$($LCTL get_param mdc.*.import | grep client_encryption)
        [ -n "$cli_enc" ] || skip "Need enc support"
@@ -6186,9 +6185,6 @@ test_66() {
        fscrypt_setup $MOUNT 0
        stack_trap "rm -rf $MOUNT/.fscrypt"
 
-       save_lustre_params client "llite.*.enable_compression" > $p
-       $LCTL set_param -n llite.*.enable_compression 1
-       stack_trap "restore_lustre_params < $p; rm -f $p" EXIT
        mkdir -p $vaultdir
        stack_trap "rm -rf $vaultdir"
        $LFS setstripe -E eof -Z lz4 --compress-chunk=64 $vaultdir ||
@@ -6265,8 +6261,7 @@ test_67() {
        local dir1=$vaultdir/compr
        local dir2=$DIR/$tdir/compr2
 
-       (( MDS1_VERSION >= $(version_code 2.14.0.101) )) ||
-               skip "Need MDS >= 2.14.0.101 for compression support"
+       compression_enabled || skip "compression is disabled ($(uname -a))"
 
        cli_enc=$($LCTL get_param mdc.*.import | grep client_encryption)
        [ -n "$cli_enc" ] || skip "Need enc support"
@@ -6277,9 +6272,6 @@ test_67() {
        fscrypt_setup $MOUNT 0
        stack_trap "rm -rf $MOUNT/.fscrypt"
 
-       save_lustre_params client "llite.*.enable_compression" > $p
-       $LCTL set_param -n llite.*.enable_compression 1
-       stack_trap "restore_lustre_params < $p; rm -f $p" EXIT
        mkdir -p $vaultdir
        stack_trap "rm -rf $vaultdir"
 
index 3709106..afa2287 100644 (file)
@@ -28625,9 +28625,8 @@ test_460a() {
                echo "bunzip2 is not installed, skip it"
        fi
 
-       stack_trap "rm -Rf $DIR/$tdir; rm -Rf $TMP/$tdir; disable_compression"
-
-       enable_compression
+       stack_trap "rm -Rf $DIR/$tdir; rm -Rf $TMP/$tdir"
+       compression_enabled || skip "compression is disabled ($(uname -a))"
 
        # test script itself, as a sample text file to compress
        compress_content $0 false
@@ -28671,8 +28670,8 @@ test_460b() {
        local stored=$DIR/$tdir/foofile
        test_mkdir $DIR/$tdir
 
-       stack_trap "rm -Rf $DIR/$tdir; disable_compression"
-       enable_compression
+       stack_trap "rm -Rf $DIR/$tdir"
+       compression_enabled || skip "compression is disabled ($(uname -a))"
 
        $LFS setstripe -E 512K -Z gzip:5 -E 768K -Z none -E -1 -Z lz4:5 \
                --compress-chunk=64 $stored ||
@@ -28707,8 +28706,8 @@ test_460c() {
        test_mkdir $DIR/$tdir
        test_mkdir $TMP/$tdir
 
-       stack_trap "rm -Rf $DIR/$tdir; rm -Rf $TMP/$tdir; disable_compression"
-       enable_compression
+       stack_trap "rm -Rf $DIR/$tdir; rm -Rf $TMP/$tdir"
+       compression_enabled || skip "compression is disabled ($(uname -a))"
 
        $LFS setstripe -E 2M -Z gzip:5 -E 10M -Z none -E -1 -Z lz4:5 \
                --compress-chunk=64 $stored ||
@@ -28759,8 +28758,8 @@ test_460e() {
 
        local tf=$DIR/$tfile
 
-       stack_trap "rm -f $tf; disable_compression"
-       enable_compression
+       stack_trap "rm -f $tf"
+       compression_enabled || skip "compression is disabled ($(uname -a))"
 
        $LFS setstripe -E -1 -Z lz4:5 --compress-chunk=64 $tf ||
                error "set a compress component in $tf failed"
@@ -28793,8 +28792,8 @@ test_460f() {
 
        local tf=$DIR/$tfile
 
-       stack_trap "rm -f $tf; disable_compression"
-       enable_compression
+       stack_trap "rm -f $tf"
+       compression_enabled || skip "compression is disabled ($(uname -a))"
 
        $LFS setstripe -E -1 -Z gzip:3 --compress-chunk=64 $tf ||
                error "set a compress component in $tf failed"
@@ -28825,8 +28824,8 @@ test_460g() {
 
        local tf=$DIR/$tfile
 
-       stack_trap "rm -f $tf; disable_compression"
-       enable_compression
+       stack_trap "rm -f $tf"
+       compression_enabled || skip "compression is disabled ($(uname -a))"
 
        $LFS setstripe -E -1 -Z gzip:3 --compress-chunk=64 $tf ||
                error "set a compress component in $tf failed"
index a41961f..f2ac917 100755 (executable)
@@ -10729,6 +10729,15 @@ verify_comp_attr() {
        }
 }
 
+compression_enabled() {
+       local facet=${1:-osc}
+       local enabled=($($LCTL get_param -n llite.*.enable_compression))
+       local supported=($($LCTL get_param -n $facet.*.import |
+                          grep -c compress_types))
+
+       (( $enabled && $supported )) && return true || return false
+}
+
 enable_compression() {
        $LCTL set_param -n llite.*.enable_compression=1
        export LFS_SETSTRIPE_COMPR_OK=y