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) 2018 by Delphix. All rights reserved.
18 . $STF_SUITE/tests/functional/redacted_send/redacted.kshlib
22 # Verify redacted send can deal with a large redaction list.
25 # 1. Create 64 clones of sendfs each of which modifies two blocks in a file.
26 # The first modification is at an offset unique to each clone, and the
27 # second (the last block in the file) is common to them all.
28 # 2. Verify a redacted stream with a reasonable redaction list length can
29 # be correctly processed.
30 # 3. Verify that if the list is too long, the send fails gracefully.
33 typeset ds_name="many_clones"
34 typeset sendfs="$POOL/$ds_name"
35 typeset recvfs="$POOL2/$ds_name"
36 typeset clone="$POOL/${ds_name}_clone"
37 typeset tmpdir="$(get_prop mountpoint $POOL)/tmp"
38 typeset stream=$(mktemp $tmpdir/stream.XXXX)
39 setup_dataset $ds_name ''
40 typeset clone_mnt="$(get_prop mountpoint $clone)"
41 typeset send_mnt="$(get_prop mountpoint $sendfs)"
42 typeset recv_mnt="/$POOL2/$ds_name"
43 typeset redaction_list=''
46 log_onexit redacted_cleanup $sendfs $recvfs
48 # Fill in both the last block, and a different block in every clone.
50 log_must zfs clone $sendfs@snap ${clone}$i
51 mntpnt=$(get_prop mountpoint ${clone}$i)
52 log_must dd if=/dev/urandom of=$mntpnt/f2 bs=64k count=1 seek=$i \
54 log_must dd if=/dev/urandom of=$mntpnt/f2 bs=64k count=1 seek=63 \
56 log_must zfs snapshot ${clone}$i@snap
59 # The limit isn't necessarily 32 snapshots. The maximum number of snapshots in
60 # the redacted list is determined in dsl_bookmark_create_redacted_check().
61 log_must zfs redact $sendfs@snap book1 $clone{1..32}@snap
62 log_must eval "zfs send --redact book1 $sendfs@snap >$stream"
63 log_must eval "zfs recv $recvfs <$stream"
64 compare_files $sendfs $recvfs "f2" "$RANGE8"
66 log_mustnot zfs redact $sendfs@snap book2 $clone{1..64}@snap
68 log_pass "Redacted send can deal with a large redaction list."