-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add last_scrubbed_txg property and option to scrub from last saved txg
The `last_scrubbed_txg` property indicates the transaction group (TXG) up to which the most recent scrub operation has checked and repaired the dataset. This provides administrators with insight into the data integrity status of their pool at a specific point in time. Sponsored-By: Wasabi Technology, Inc. Sponsored-By: Klara Inc. Signed-off-by: Mariusz Zaborski <[email protected]>
- Loading branch information
Showing
15 changed files
with
184 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
.\" Copyright (c) 2021, Colm Buckley <[email protected]> | ||
.\" Copyright (c) 2023, Klara Inc. | ||
.\" | ||
.Dd January 2, 2024 | ||
.Dd June 20, 2024 | ||
.Dt ZPOOLPROPS 7 | ||
.Os | ||
. | ||
|
@@ -129,6 +129,14 @@ A unique identifier for the pool. | |
The current health of the pool. | ||
Health can be one of | ||
.Sy ONLINE , DEGRADED , FAULTED , OFFLINE, REMOVED , UNAVAIL . | ||
.It Sy last_scrubbed_txg | ||
Indicates the transaction group (TXG) up to which the most recent scrub | ||
operation has checked and repaired the dataset. | ||
This provides insight into the data integrity status of their pool at | ||
a specific point in time. | ||
The | ||
.Xr zpool-scrub 8 | ||
might be used to utilize this property. | ||
.It Sy leaked | ||
Space not released while | ||
.Sy freeing | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
tests/zfs-tests/tests/functional/cli_root/zpool_scrub/zpool_scrub_txg_continue_from_last.ksh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#!/bin/ksh -p | ||
# | ||
# CDDL HEADER START | ||
# | ||
# The contents of this file are subject to the terms of the | ||
# Common Development and Distribution License (the "License"). | ||
# You may not use this file except in compliance with the License. | ||
# | ||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | ||
# or https://opensource.org/licenses/CDDL-1.0. | ||
# See the License for the specific language governing permissions | ||
# and limitations under the License. | ||
# | ||
# When distributing Covered Code, include this CDDL HEADER in each | ||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. | ||
# If applicable, add the following below this CDDL HEADER, with the | ||
# fields enclosed by brackets "[]" replaced with your own identifying | ||
# information: Portions Copyright [yyyy] [name of copyright owner] | ||
# | ||
# CDDL HEADER END | ||
# | ||
|
||
# Copyright (c) 2023, Klara Inc. | ||
# | ||
# This software was developed by | ||
# Mariusz Zaborski <[email protected]> | ||
# under sponsorship from Wasabi Technology, Inc. and Klara Inc. | ||
|
||
. $STF_SUITE/include/libtest.shlib | ||
. $STF_SUITE/tests/functional/cli_root/zpool_scrub/zpool_scrub.cfg | ||
. $STF_SUITE/tests/functional/cli_root/zpool_import/zpool_import.kshlib | ||
|
||
# | ||
# DESCRIPTION: | ||
# Verify scrub -C | ||
# | ||
# STRATEGY: | ||
# 1. Create a pool and create one file. | ||
# 2. Verify that the last_txg_scrub is 0. | ||
# 3. Run scrub. | ||
# 4. Verify that the last_txg_scrub is set. | ||
# 5. Create second file. | ||
# 6. Invalidate both files. | ||
# 7. Run scrub only from last point. | ||
# 8. Verify that only one file, that was created with newer txg, | ||
# was detected. | ||
# | ||
|
||
verify_runnable "global" | ||
|
||
function cleanup | ||
{ | ||
log_must zinject -c all | ||
log_must rm -f $mntpnt/f1 | ||
log_must rm -f $mntpnt/f2 | ||
} | ||
|
||
log_onexit cleanup | ||
|
||
log_assert "Verify scrub -C." | ||
|
||
# Create one file. | ||
mntpnt=$(get_prop mountpoint $TESTPOOL/$TESTFS) | ||
|
||
log_must file_write -b 1048576 -c 10 -o create -d 0 -f $mntpnt/f1 | ||
log_must sync_pool $TESTPOOL true | ||
f1txg=$(get_last_txg_synced $TESTPOOL) | ||
|
||
# Verify that last_scrubbed_txg isn't set. | ||
zpoollasttxg=$(zpool get -H -o value last_scrubbed_txg $TESTPOOL) | ||
log_must [ $zpoollasttxg -eq 0 ] | ||
|
||
# Run scrub. | ||
log_must zpool scrub -w $TESTPOOL | ||
|
||
# Verify that last_scrubbed_txg is set. | ||
zpoollasttxg=$(zpool get -H -o value last_scrubbed_txg $TESTPOOL) | ||
log_must [ $zpoollasttxg -ne 0 ] | ||
|
||
# Create second file. | ||
log_must file_write -b 1048576 -c 10 -o create -d 0 -f $mntpnt/f2 | ||
log_must sync_pool $TESTPOOL true | ||
f2txg=$(get_last_txg_synced $TESTPOOL) | ||
|
||
# Make sure that the sync txg are different. | ||
log_must [ $f1txg -ne $f2txg ] | ||
|
||
# Insert faults. | ||
log_must zinject -a -t data -e io -T read $mntpnt/f1 | ||
log_must zinject -a -t data -e io -T read $mntpnt/f2 | ||
|
||
# Run scrub from last saved point. | ||
log_must zpool scrub -w -C $TESTPOOL | ||
|
||
# Verify that only newer file was detected. | ||
log_mustnot eval "zpool status -v $TESTPOOL | grep '$mntpnt/f1'" | ||
log_must eval "zpool status -v $TESTPOOL | grep '$mntpnt/f2'" | ||
|
||
# Verify that both files are corrupted. | ||
log_must zpool scrub -w $TESTPOOL | ||
log_must eval "zpool status -v $TESTPOOL | grep '$mntpnt/f1'" | ||
log_must eval "zpool status -v $TESTPOOL | grep '$mntpnt/f2'" | ||
|
||
log_pass "Verified scrub -C show expected status." |