]>
git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/rsend/send_spill_block.ksh
4 # This file and its contents are supplied under the terms of the
5 # Common Development and Distribution License ("CDDL"), version 1.0.
6 # You may only use this file in accordance with the terms of version
9 # A full copy of the text of the CDDL should have accompanied this
10 # source. A copy of the CDDL is also available via the Internet at
11 # http://www.illumos.org/license/CDDL.
15 # Copyright (c) 2019 by Lawrence Livermore National Security, LLC.
18 .
$STF_SUITE/include
/libtest.shlib
19 .
$STF_SUITE/tests
/functional
/rsend
/rsend.kshlib
23 # Verify spill blocks are correctly preserved.
26 # 1) Create a set of files each containing some file data.
27 # 2) Add enough xattrs to the file to require a spill block.
28 # 3) Snapshot and send these files to a new dataset.
29 # 4) Modify the files and spill blocks in a variety of ways.
30 # 5) Send the changes using an incremental send stream.
31 # 6) Verify that all the xattrs (and thus the spill block) were
32 # preserved when receiving the incremental stream.
35 verify_runnable
"both"
37 log_assert
"Verify spill blocks are correctly preserved"
42 destroy_dataset
$POOL/fs
"-rR"
43 destroy_dataset
$POOL/newfs
"-rR"
46 attrvalue
="abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
50 log_must zfs create
$POOL/fs
51 log_must zfs
set xattr
=sa
$POOL/fs
52 log_must zfs
set dnodesize
=legacy
$POOL/fs
53 log_must zfs
set recordsize
=128k
$POOL/fs
55 # Create 40 files each with a spill block containing xattrs. Each file
56 # will be modified in a different way to validate the incremental receive.
58 file="/$POOL/fs/file$i"
60 log_must mkfile
16384 $file
62 log_must attr
-qs "testattr$j" -V "$attrvalue" $file
66 # Snapshot the pool and send it to the new dataset.
67 log_must zfs snapshot
$POOL/fs@snap1
68 log_must
eval "zfs send -e $POOL/fs@snap1 >$BACKDIR/fs@snap1"
69 log_must
eval "zfs recv $POOL/newfs < $BACKDIR/fs@snap1"
72 # Modify file[1-6]'s contents but not the spill blocks.
74 # file1 - Increase record size; single block
75 # file2 - Increase record size; multiple blocks
76 # file3 - Truncate file to zero size; single block
77 # file4 - Truncate file to smaller size; single block
78 # file5 - Truncate file to much larger size; add holes
79 # file6 - Truncate file to embedded size; embedded data
81 log_must mkfile
32768 /$POOL/fs
/file1
82 log_must mkfile
1048576 /$POOL/fs
/file2
83 log_must truncate
-s 0 /$POOL/fs
/file3
84 log_must truncate
-s 8192 /$POOL/fs
/file4
85 log_must truncate
-s 1073741824 /$POOL/fs
/file5
86 log_must truncate
-s 50 /$POOL/fs
/file6
89 # Modify file[11-16]'s contents and their spill blocks.
91 # file11 - Increase record size; single block
92 # file12 - Increase record size; multiple blocks
93 # file13 - Truncate file to zero size; single block
94 # file14 - Truncate file to smaller size; single block
95 # file15 - Truncate file to much larger size; add holes
96 # file16 - Truncate file to embedded size; embedded data
98 log_must mkfile
32768 /$POOL/fs
/file11
99 log_must mkfile
1048576 /$POOL/fs
/file12
100 log_must truncate
-s 0 /$POOL/fs
/file13
101 log_must truncate
-s 8192 /$POOL/fs
/file14
102 log_must truncate
-s 1073741824 /$POOL/fs
/file15
103 log_must truncate
-s 50 /$POOL/fs
/file16
105 for i
in {11.
.20}; do
106 log_must attr
-qr testattr1
/$POOL/fs
/file$i
110 # Modify file[21-26]'s contents and remove their spill blocks.
112 # file21 - Increase record size; single block
113 # file22 - Increase record size; multiple blocks
114 # file23 - Truncate file to zero size; single block
115 # file24 - Truncate file to smaller size; single block
116 # file25 - Truncate file to much larger size; add holes
117 # file26 - Truncate file to embedded size; embedded data
119 log_must mkfile
32768 /$POOL/fs
/file21
120 log_must mkfile
1048576 /$POOL/fs
/file22
121 log_must truncate
-s 0 /$POOL/fs
/file23
122 log_must truncate
-s 8192 /$POOL/fs
/file24
123 log_must truncate
-s 1073741824 /$POOL/fs
/file25
124 log_must truncate
-s 50 /$POOL/fs
/file26
126 for i
in {21.
.30}; do
128 log_must attr
-qr testattr
$j /$POOL/fs
/file$i
133 # Modify file[31-40]'s spill blocks but not the file contents.
135 for i
in {31.
.40}; do
136 file="/$POOL/fs/file$i"
137 log_must attr
-qr testattr$
(((RANDOM
% 20) + 1)) $file
138 log_must attr
-qs testattr$
(((RANDOM
% 20) + 1)) -V "$attrvalue" $file
141 # Calculate the expected recursive checksum for the source.
142 expected_cksum
=$
(recursive_cksum
/$POOL/fs
)
144 # Snapshot the pool and send the incremental snapshot.
145 log_must zfs snapshot
$POOL/fs@snap2
146 log_must
eval "zfs send -e -i $POOL/fs@snap1 $POOL/fs@snap2 >$BACKDIR/fs@snap2"
147 log_must
eval "zfs recv -F $POOL/newfs < $BACKDIR/fs@snap2"
149 # Validate the received copy using the received recursive checksum.
150 actual_cksum
=$
(recursive_cksum
/$POOL/newfs
)
151 if [[ "$expected_cksum" != "$actual_cksum" ]]; then
152 log_fail
"Checksums differ ($expected_cksum != $actual_cksum)"
155 log_pass
"Verify spill blocks are correctly preserved"