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) 2017, 2018 by Delphix. All rights reserved.
18 . $STF_SUITE/tests/functional/pool_checkpoint/pool_checkpoint.kshlib
22 # The maximum address that can be described by a single-word
23 # space map entry limits the maximum allocatable space of any
24 # top-level vdev to 64PB whenever a vdev-wide space map is used.
26 # Since a vdev-wide space map is introduced for the checkpoint
27 # we want to ensure that we cannot checkpoint a pool that does
28 # not use the new space map encoding (V2) and has a top-level
29 # vdev with more than 64PB of allocatable space.
31 # Note: Since this is a pool created from file-based vdevs we
32 # are guaranteed that vdev_ashift is SPA_MINBLOCKSHIFT
33 # [which is currently 9 and (1 << 9) = 512], so the numbers
34 # work out for this test.
37 # 1. Create pool with a disk of exactly 64PB
38 # (so ~63.5PB of allocatable space) and
39 # ensure that has the checkpoint feature
40 # enabled but not space map V2
41 # 2. Ensure that you can checkpoint it
42 # 3. Create pool with a disk of exactly 65PB
43 # (so ~64.5PB of allocatable space) with
45 # 4. Ensure we fail trying to checkpoint it
48 # This test used to create the two pools and attempt to checkpoint
49 # them at the same time, then destroy them. We later had to change
50 # this to test one pool at a time as the metaslabs (even though empty)
51 # consumed a lot of memory, especially on a machine that has been
52 # running with debug enabled. To give an example, each metaslab
53 # structure is ~1712 bytes (at the time of this writing), and each
54 # vdev has 128K metaslabs, which means that just the structures
55 # consume 131071 * 1712 = ~224M.
58 verify_runnable "global"
63 DISK64PB=/$DISKFS/disk64PB
64 DISK65PB=/$DISKFS/disk65PB
68 poolexists $TESTPOOL1 && destroy_pool $TESTPOOL1
69 poolexists $TESTPOOL2 && destroy_pool $TESTPOOL2
70 log_must rm -f $DISK64PB $DISK65PB
75 log_onexit test_cleanup
77 log_must zfs create $DISKFS
78 log_must mkfile -n $((64 * 1024 * 1024))g $DISK64PB
79 log_must mkfile -n $((65 * 1024 * 1024))g $DISK65PB
81 log_must zpool create -d $TESTPOOL1 $DISK64PB
82 log_must zpool set feature@zpool_checkpoint=enabled $TESTPOOL1
83 log_must zpool checkpoint $TESTPOOL1
84 destroy_pool $TESTPOOL1
86 log_must zpool create -d $TESTPOOL2 $DISK65PB
87 log_must zpool set feature@zpool_checkpoint=enabled $TESTPOOL2
88 log_mustnot zpool checkpoint $TESTPOOL2
89 destroy_pool $TESTPOOL2
91 log_pass "Fail to checkpoint pool with old spacemap encoding" \
92 " and a vdev that's more than 64PB."