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# Rewind to checkpoint on a stressed pool. We basically try to 23# fragment the pool before and after taking a checkpoint and 24# see if zdb finds any checksum or other errors that imply that 25# blocks from the checkpoint have been reused. 26# 27# STRATEGY: 28# 1. Import pool that's slightly fragmented 29# 2. Take checkpoint 30# 3. Apply a destructive action and do more random writes 31# 4. Run zdb on both current and checkpointed data and make 32# sure that zdb returns with no errors 33# 5. Rewind to checkpoint 34# 6. Run zdb again 35# 36 37verify_runnable "global" 38 39setup_nested_pool_state 40log_onexit cleanup_nested_pools 41 42log_must zpool checkpoint $NESTEDPOOL 43 44# 45# Destroy one dataset, modify an existing one and create a 46# a new one. Do more random writes in an attempt to raise 47# more fragmentation. Then verify both current and checkpointed 48# states. 49# 50fragment_after_checkpoint_and_verify 51 52log_must zpool export $NESTEDPOOL 53log_must zpool import -d $FILEDISKDIR --rewind-to-checkpoint $NESTEDPOOL 54 55log_must zpool export $NESTEDPOOL 56log_must zdb -e -p $FILEDISKDIR $NESTEDPOOL 57 58log_pass "Rewind to checkpoint on a stressed pool." 59