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 by Delphix. All rights reserved.
18 .
$STF_SUITE/tests
/functional
/pool_checkpoint
/pool_checkpoint.kshlib
22 # Ensure that checkpoint verification within zdb wowrks as
29 # 4. Modify data (include at least one destructive change)
30 # 5. Verify zdb finds checkpoint when run on current state
31 # 6. Verify zdb finds old dataset when run on checkpointed
33 # 7. Discard checkpoint
34 # 8. Verify zdb does not find the checkpoint anymore in the
36 # 9. Verify that zdb cannot find the checkpointed state
37 # anymore when trying to open it for verification.
40 verify_runnable
"global"
43 # zdb does this thing where it imports the checkpointed state of the
44 # pool under a new pool with a different name, alongside the pool
45 # with the current state. The name of this temporary pool is the
46 # name of the actual pool with the suffix below appended to it.
48 CHECKPOINT_SUFFIX
="_CHECKPOINTED_UNIVERSE"
49 CHECKPOINTED_FS1
=$TESTPOOL$CHECKPOINT_SUFFIX/$TESTFS1
52 log_onexit cleanup_test_pool
55 log_must zpool checkpoint
$TESTPOOL
57 test_change_state_after_checkpoint
59 zdb
$TESTPOOL |
grep "Checkpointed uberblock found" || \
60 log_fail
"zdb could not find checkpointed uberblock"
62 zdb
-k $TESTPOOL |
grep "Checkpointed uberblock found" && \
63 log_fail
"zdb found checkpointed uberblock in checkpointed state"
65 zdb
$TESTPOOL |
grep "Dataset $FS1" && \
66 log_fail
"zdb found destroyed dataset in current state"
68 zdb
-k $TESTPOOL |
grep "Dataset $CHECKPOINTED_FS1" || \
69 log_fail
"zdb could not find destroyed dataset in checkpoint"
71 log_must zpool checkpoint
-d $TESTPOOL
73 zdb
$TESTPOOL |
grep "Checkpointed uberblock found" && \
74 log_fail
"zdb found checkpointed uberblock after discarding " \
78 log_fail
"zdb opened checkpointed state that was discarded"
80 log_pass
"zdb can analyze checkpointed pools."