From ae4b55a147ab250a4c5b68543a2707db0569b0fb Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Mon, 15 Apr 2024 13:57:18 -0400 Subject: [PATCH] Add basic parallel_restore test script This script executes the basic parallel_restore test binary which incorporates the parallel restore library. The test binary creates a few files with xattrs. After restoring, we mount the filesystem and do some basic checks to see that the restore was complete. Added just under and just over ENOSPC cases to make sure that we are returning the final 5% of this disk that we reserver for log trees. Signed-off-by: Auke Kok Signed-off-by: Hunter Shaffer --- tests/golden/parallel_restore | 28 ++++++++++++ tests/sequence | 1 + tests/tests/parallel_restore.sh | 78 +++++++++++++++++++++++++++++++++ 3 files changed, 107 insertions(+) create mode 100644 tests/golden/parallel_restore create mode 100644 tests/tests/parallel_restore.sh diff --git a/tests/golden/parallel_restore b/tests/golden/parallel_restore new file mode 100644 index 00000000..5ef47940 --- /dev/null +++ b/tests/golden/parallel_restore @@ -0,0 +1,28 @@ +== simple mkfs/restore/mount +committed_seq 1120 +total_meta_blocks 163840 +total_data_blocks 15728640 + 1440 1440 57120 + 80 80 400 +0: offset: 0 length: 1 flags: O.L +extents: 1 +0: offset: 0 length: 1 flags: O.L +extents: 1 +0: offset: 0 length: 1 flags: O.L +extents: 1 +0: offset: 0 length: 1 flags: O.L +extents: 1 + Type Size Total Used Free Use% +MetaData 64KB 163840 34722 129118 21 + Data 4KB 15728640 64 15728576 0 + 7 13,L,- 15,L,- 17,L,- I 33 - +== just under ENOSPC + Type Size Total Used Free Use% +MetaData 64KB 163840 155666 8174 95 + Data 4KB 15728640 64 15728576 0 +== just over ENOSPC +== ENOSPC +== attempt to restore data device +== attempt format_v1 restore +== test if previously mounted +== cleanup diff --git a/tests/sequence b/tests/sequence index 16e0e465..f15378d5 100644 --- a/tests/sequence +++ b/tests/sequence @@ -54,4 +54,5 @@ archive-light-cycle.sh block-stale-reads.sh inode-deletion.sh renameat2-noreplace.sh +parallel_restore.sh xfstests.sh diff --git a/tests/tests/parallel_restore.sh b/tests/tests/parallel_restore.sh new file mode 100644 index 00000000..232c574c --- /dev/null +++ b/tests/tests/parallel_restore.sh @@ -0,0 +1,78 @@ +# +# validate parallel restore library +# + +t_require_commands scoutfs parallel_restore find xargs + +SCR="$T_TMPDIR/mnt.scratch" +mkdir -p "$SCR" + +scratch_mkfs() { + scoutfs mkfs $@ \ + -A -f -Q 0,127.0.0.1,53000 $T_EX_META_DEV $T_EX_DATA_DEV +} + +scratch_check() { + # give ample time for writes to commit + sleep 1 + sync + scoutfs check -d ${T_TMPDIR}/check.debug $T_EX_META_DEV $T_EX_DATA_DEV +} + +scratch_mount() { + mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 $T_EX_DATA_DEV $SCR +} + + +echo "== simple mkfs/restore/mount" +# meta device just big enough for reserves and the metadata we'll fill +scratch_mkfs -V 2 -m 10G -d 60G > $T_TMP.mkfs.out 2>&1 || t_fail "mkfs failed" +parallel_restore -m "$T_EX_META_DEV" > /dev/null || t_fail "parallel_restore" +scratch_check || t_fail "check failed" +scratch_mount + +scoutfs statfs -p "$SCR" | grep -v -e 'fsid' -e 'rid' +find "$SCR" -exec scoutfs list-hidden-xattrs {} \; | wc +scoutfs search-xattrs -p "$SCR" scoutfs.hide.srch.sam_vol_F01030L6 -p "$SCR" | wc +find "$SCR" -type f -name "file-*" | head -n 4 | xargs -n 1 scoutfs get-fiemap -L +scoutfs df -p "$SCR" +scoutfs quota-list -p "$SCR" +umount "$SCR" +scratch_check || t_fail "check after mount failed" + +echo "== just under ENOSPC" +scratch_mkfs -V 2 -m 10G -d 60G > $T_TMP.mkfs.out 2>&1 || t_fail "mkfs failed" +parallel_restore -m "$T_EX_META_DEV" -n 3000000 > /dev/null || t_fail "parallel_restore" +scratch_check || t_fail "check failed" +scratch_mount +scoutfs df -p "$SCR" +umount "$SCR" +scratch_check || t_fail "check after mount failed" + +echo "== just over ENOSPC" +scratch_mkfs -V 2 -m 10G -d 60G > $T_TMP.mkfs.out 2>&1 || t_fail "mkfs failed" +parallel_restore -m "$T_EX_META_DEV" -n 3500000 | grep died 2>&1 && t_fail "parallel_restore" +scratch_check || t_fail "check failed" + +echo "== ENOSPC" +scratch_mkfs -V 2 -m 10G -d 60G > $T_TMP.mkfs.out 2>&1 || t_fail "mkfs failed" +parallel_restore -m "$T_EX_META_DEV" -d 600:1000 -f 600:1000 -n 4000000 | grep died 2>&1 && t_fail "parallel_restore" + +echo "== attempt to restore data device" +scratch_mkfs -V 2 -m 10G -d 60G > $T_TMP.mkfs.out 2>&1 || t_fail "mkfs failed" +parallel_restore -m "$T_EX_DATA_DEV" | grep died 2>&1 && t_fail "parallel_restore" + +echo "== attempt format_v1 restore" +scratch_mkfs -V 1 -m 10G -d 60G > $T_TMP.mkfs.out 2>&1 || t_fail "mkfs failed" +parallel_restore -m "$T_EX_META_DEV" | grep died 2>&1 && t_fail "parallel_restore" + +echo "== test if previously mounted" +scratch_mkfs -V 2 -m 10G -d 60G > $T_TMP.mkfs.out 2>&1 || t_fail "mkfs failed" +mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 \ + "$T_EX_DATA_DEV" "$SCR" +umount "$SCR" +parallel_restore -m "$T_EX_META_DEV" | grep died 2>&1 && t_fail "parallel_restore" + +echo "== cleanup" +rmdir "$SCR" +t_pass