-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to scrub from last scrubbed txg #16301
base: master
Are you sure you want to change the base?
Conversation
68edb6e
to
42d967f
Compare
42d967f
to
8d59c2c
Compare
I noticed a $ sudo ./zpool scrub tank && sleep 1 && sudo ./zpool scrub -p tank
$ sudo ./zpool status
pool: tank
state: ONLINE
scan: scrub paused since Tue Aug 27 16:02:26 2024
scrub started on Tue Aug 27 16:02:25 2024
14.7G / 14.7G scanned, 3.22G / 14.7G issued
0B repaired, 21.95% done
config:
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
vdb ONLINE 0 0 0
errors: No known data errors
$ sudo ./zpool scrub -C tank
cannot scrub tank: delegated administration is disabled on pool
$ echo $?
1
$ sudo ./zpool status
pool: tank
state: ONLINE
scan: scrub repaired 0B in 00:00:14 with 0 errors on Tue Aug 27 16:02:39 2024
config:
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
vdb ONLINE 0 0 0
errors: No known data errors It returns an error code, but then the scrub seems to complete successfully. Any thoughts? |
@tonyhutter This is after the applied patch, but without it, it works fine? |
Sponsored-By: Wasabi Technology, Inc. Sponsored-By: Klara Inc. Signed-off-by: Mariusz Zaborski <[email protected]>
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]>
8d59c2c
to
cc72197
Compare
I have added another feature just to scrub "recent data". |
cc72197
to
4823cc2
Compare
Sponsored-By: Wasabi Technology, Inc. Sponsored-By: Klara Inc. Signed-off-by: Mariusz Zaborski <[email protected]>
cb.cb_scrub_cmd = POOL_SCRUB_PAUSE; | ||
} else if (is_stop) { | ||
cb.cb_type = POOL_SCAN_NONE; | ||
} else if (is_txg_continue) { | ||
cb.cb_scrub_cmd = POOL_SCRUB_FROM_LAST_TXG; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like -C
and -R
should also be mutually exclusive.
@@ -506,7 +506,8 @@ get_usage(zpool_help_t idx) | |||
return (gettext("\tinitialize [-c | -s | -u] [-w] <pool> " | |||
"[<device> ...]\n")); | |||
case HELP_SCRUB: | |||
return (gettext("\tscrub [-s | -p] [-w] [-e] <pool> ...\n")); | |||
return (gettext("\tscrub [-s | -p] [-w] [-e] [-C] [-R] " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return (gettext("\tscrub [-s | -p] [-w] [-e] [-C] [-R] " | |
return (gettext("\tscrub [-e | -p | -s | -C | -R] [-w] " |
They all seem to be mutually exclusive.
@@ -8391,11 +8392,13 @@ wait_callback(zpool_handle_t *zhp, void *data) | |||
} | |||
|
|||
/* | |||
* zpool scrub [-s | -p] [-w] [-e] <pool> ... | |||
* zpool scrub [-s | -p] [-w] [-e] [-C] <pool> ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* zpool scrub [-s | -p] [-w] [-e] [-C] <pool> ... | |
* zpool scrub [-e | -p | -s | -C | -R] [-w] <pool> ... |
.Op Fl s Ns | Ns Fl p | ||
.Op Fl w | ||
.Op Fl e | ||
.Op Fl C | ||
.Op Fl R |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.Op Fl s Ns | Ns Fl p | |
.Op Fl w | |
.Op Fl e | |
.Op Fl C | |
.Op Fl R | |
.Op Ns Fl e | Ns Fl p | Fl s Ns | Fl C Ns | Fl R Ns | |
.Op Fl w |
ASSERT(setup_sync_arg->func > POOL_SCAN_NONE && | ||
setup_sync_arg->func < POOL_SCAN_FUNCS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just cosmetics, but I would use two ASSERT3U()
instead.
Motivation and Context
Sometimes it is useful to only scrub a particular range of txg. Some users might want to scrub only new data because they would like to know if the new write wasn't corrupted. This PR adds possiblity scrub only newly flushed data.
Description
Users who would like to scrub only new data, a new zpool property was introduced, that stores last scrubbed txg, so users can run scrub only from the last saved point.
We use a scn_max_txg and scn_min_txg which are already built into scrub, to accomplish that.
How Has This Been Tested?
Via test cases.
Types of changes
Checklist:
Signed-off-by
.