1139969Simp#!/bin/ksh -p
21556Srgrimes
31556Srgrimes#
41556Srgrimes# This file and its contents are supplied under the terms of the
51556Srgrimes# Common Development and Distribution License ("CDDL"), version 1.0.
61556Srgrimes# You may only use this file in accordance with the terms of version
71556Srgrimes# 1.0 of the CDDL.
81556Srgrimes#
91556Srgrimes# A full copy of the text of the CDDL should have accompanied this
101556Srgrimes# source.  A copy of the CDDL is also available via the Internet at
111556Srgrimes# http://www.illumos.org/license/CDDL.
121556Srgrimes#
131556Srgrimes
141556Srgrimes#
151556Srgrimes# Copyright (c) 2017, 2018 by Delphix. All rights reserved.
161556Srgrimes#
171556Srgrimes
181556Srgrimes. $STF_SUITE/tests/functional/pool_checkpoint/pool_checkpoint.kshlib
191556Srgrimes
201556Srgrimes#
211556Srgrimes# DESCRIPTION:
221556Srgrimes#	Ensure that checkpoint plays well with indirect mappings
231556Srgrimes#	and blocks.
241556Srgrimes#
251556Srgrimes# STRATEGY:
261556Srgrimes#	1. Import pool that's slightly fragmented
271556Srgrimes#	2. Introduce indirection by removing and re-adding devices
281556Srgrimes#	3. Take checkpoint
291556Srgrimes#	4. Apply a destructive action and do more random writes
301556Srgrimes#	5. Run zdb on both current and checkpointed data and make
311556Srgrimes#	   sure that zdb returns with no errors
321556Srgrimes#
33114433Sobrien
341556Srgrimesverify_runnable "global"
3520412Ssteve
361556Srgrimessetup_nested_pool_state
371556Srgrimeslog_onexit cleanup_nested_pools
381556Srgrimes
391556Srgrimes#
401556Srgrimes# Remove and re-add all disks.
4136003Scharnier#
42114433Sobrienintroduce_indirection
4335773Scharnier
4499109Sobrien#
4599109Sobrien# Display fragmentation after removals
461556Srgrimes#
471556Srgrimeslog_must zpool list -v
481556Srgrimes
498855Srgrimeslog_must zpool checkpoint $NESTEDPOOL
501556Srgrimes
511556Srgrimes#
5220412Ssteve# Destroy one dataset, modify an existing one and create a
538855Srgrimes# a new one. Do more random writes in an attempt to raise
541556Srgrimes# more fragmentation. Then verify both current and checkpointed
551556Srgrimes# states.
561556Srgrimes#
571556Srgrimesfragment_after_checkpoint_and_verify
581556Srgrimes
591556Srgrimeslog_pass "Running correctly on indirect setups with a checkpoint."
601556Srgrimes