Whamcloud - gitweb
EX-7601 tests: add multi-mount compression test
authorPatrick Farrell <pfarrell@whamcloud.com>
Fri, 29 Dec 2023 20:10:36 +0000 (15:10 -0500)
committerAndreas Dilger <adilger@whamcloud.com>
Sat, 6 Jan 2024 08:21:03 +0000 (08:21 +0000)
This adds a multi-mount correctness test for compression.
This races IO from two mountpoints at varying sizes to
stress test compression.

Test-Parameters: trivial
Test-Parameters: testlist=sanity-compr env=ONLY=1006
Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: If49cbd6d171068faa802835146f273d835b39bc3
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/51842
Reviewed-by: Artem Blagodarenko <ablagodarenko@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/tests/sanity-compr.sh

index a0f78ee..d971c89 100644 (file)
@@ -719,6 +719,77 @@ test_1005() {
 }
 run_test 1005 "test for write updating with partial chunks"
 
+test_1006() {
+       local tf=$DIR/$tfile
+       local tf2=$DIR2/$tfile
+       local hdf=$LUSTRE/tests/AMSR_E_L3_DailyOcean_V05_20111003.hdf
+       local tmp_hdf=$TMP/$tfile.hdf
+       local source=$tmp_hdf
+       # Larger than arm page size
+       local chunksize=128
+       local cs_bytes=$((chunksize * 1024))
+
+       # Larger than arm page size
+       local chunksize=128
+
+       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
+               echo "bunzip2 is not installed, skip it"
+               return 0
+       fi
+
+       mount_client $MOUNT2
+       stack_trap "umount_client $MOUNT2" EXIT
+
+       # Fail test if source size changes so we catch this
+       # 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
+
+       $LFS setstripe -E -1 -Z lz4:0 --compress-chunk=$chunksize $tf.source ||
+               error "set a compress component in $tf.source failed"
+
+       # Copy the source file to Lustre so we also read from Lustre
+       dd if=$source of=$tf.source bs=1M || error "dd to create $tf.source failed"
+       flush_and_compare $source $tf.source "(0) failed compare of source"
+
+       for bs in $((PAGE_SIZE - 1024)) $PAGE_SIZE $((PAGE_SIZE * 3/2)) \
+               $(((cs_bytes - 1024))) $cs_bytes $((cs_bytes * 3/2)); do
+
+               # Simple compressed layout
+               $LFS setstripe -E -1 -Z lz4:0 --compress-chunk=$chunksize $tf ||
+                       error "set a compress component in $tf failed"
+
+               echo "bs: $bs"
+               dd if=$tf.source bs=$bs of=$tf conv=notrunc &
+               pid1=$!
+               # Second mount with similar but not the same block size
+               dd if=$tf.source bs=$((bs * 2)) of=$tf2 conv=notrunc &
+               pid2=$!
+               wait $pid1
+               rc1=$?
+               wait $pid2
+               rc2=$?
+               if (( rc1 != 0 )); then
+                       error "copy 1 w/bsize $bs failed: $rc1"
+               fi
+               if (( rc2 != 0 )); then
+                       error "copy 2 w/bsize $bs failed: $rc2"
+               fi
+
+               flush_and_compare $source $tf "(1) failed compare with size $bs"
+               flush_and_compare $tf $tf2 "(2) failed compare with size $bs"
+               rm -f $tf $tf2
+       done
+}
+run_test 1006 "racing writes with compressed layout"
+
 complete_test $SECONDS
 check_and_cleanup_lustre
 declare -a logs=($ONLY)