1#!/usr/bin/ksh -p
2
3#
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
7# 1.0 of the CDDL.
8#
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.
12#
13
14#
15# Copyright (c) 2017, 2018 by Delphix. All rights reserved.
16#
17
18. $STF_SUITE/tests/functional/pool_checkpoint/pool_checkpoint.kshlib
19
20#
21# DESCRIPTION:
22#	Ensure that checkpoint plays well with indirect mappings
23#	and blocks.
24#
25# STRATEGY:
26#	1. Import pool that's slightly fragmented
27#	2. Introduce indirection by removing and re-adding devices
28#	3. Take checkpoint
29#	4. Apply a destructive action and do more random writes
30#	5. Run zdb on both current and checkpointed data and make
31#	   sure that zdb returns with no errors
32#
33
34verify_runnable "global"
35
36setup_nested_pool_state
37log_onexit cleanup_nested_pools
38
39#
40# Remove and re-add all disks.
41#
42introduce_indirection
43
44#
45# Display fragmentation after removals
46#
47log_must zpool list -v
48
49log_must zpool checkpoint $NESTEDPOOL
50
51#
52# Destroy one dataset, modify an existing one and create a
53# a new one. Do more random writes in an attempt to raise
54# more fragmentation. Then verify both current and checkpointed
55# states.
56#
57fragment_after_checkpoint_and_verify
58
59log_pass "Running correctly on indirect setups with a checkpoint."
60