xref: /freebsd/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_indirect.ksh (revision 61145dc2b94f12f6a47344fb9aac702321880e43)
1#!/bin/ksh -p
2# SPDX-License-Identifier: CDDL-1.0
3
4#
5# This file and its contents are supplied under the terms of the
6# Common Development and Distribution License ("CDDL"), version 1.0.
7# You may only use this file in accordance with the terms of version
8# 1.0 of the CDDL.
9#
10# A full copy of the text of the CDDL should have accompanied this
11# source.  A copy of the CDDL is also available via the Internet at
12# http://www.illumos.org/license/CDDL.
13#
14
15#
16# Copyright (c) 2017, 2018 by Delphix. All rights reserved.
17#
18
19. $STF_SUITE/tests/functional/pool_checkpoint/pool_checkpoint.kshlib
20
21#
22# DESCRIPTION:
23#	Ensure that checkpoint plays well with indirect mappings
24#	and blocks.
25#
26# STRATEGY:
27#	1. Import pool that's slightly fragmented
28#	2. Introduce indirection by removing and re-adding devices
29#	3. Take checkpoint
30#	4. Apply a destructive action and do more random writes
31#	5. Run zdb on both current and checkpointed data and make
32#	   sure that zdb returns with no errors
33#
34
35verify_runnable "global"
36
37setup_nested_pool_state
38log_onexit cleanup_nested_pools
39
40#
41# Remove and re-add all disks.
42#
43introduce_indirection
44
45#
46# Display fragmentation after removals
47#
48log_must zpool list -v
49
50log_must zpool checkpoint $NESTEDPOOL
51
52#
53# Destroy one dataset, modify an existing one and create a
54# a new one. Do more random writes in an attempt to raise
55# more fragmentation. Then verify both current and checkpointed
56# states.
57#
58fragment_after_checkpoint_and_verify
59
60log_pass "Running correctly on indirect setups with a checkpoint."
61