Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
When a disk goes offline and is later brought back online with
zpool clear
, the user may also want to trigger a scrub of the recently written data to ensure there is no corruption.For user convenience, we provide a "recent" scrub option in
zpool scrub
.Description
We use
scn_max_txg
andscn_min_txg
, which are already part of the scrub mechanism, to implement this feature.Since we (developers) don’t want to expose a configuration that specifies "the number of TXGs" (as discussed in #16301
), we instead use a time-based definition. Users can set the time using one of three units (seconds, hours, or days) for convenience. A TXG database is used to map these time ranges to valid TXG numbers.
Using time instead of TXG introduces an interesting problem: if the pool has been offline for days or weeks, and the user runs
zpool clear -s
, it may do nothing, since no recent data has been written. To handle this case, we decided to take the last known TXG from the database and use that as the starting point for scrubbing.How Has This Been Tested?
New tests have been added to the this feature.
Types of changes
Checklist:
Signed-off-by
.