Add TXG timestamp database

This feature enables tracking of when TXGs are committed to disk,
providing an estimated timestamp for each TXG.

With this information, it becomes possible to perform scrubs based
on specific date ranges, improving the granularity of data
management and recovery operations.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Reviewed-by: Paul Dagnelie <paul.dagnelie@klarasystems.com>
Signed-off-by: Mariusz Zaborski <mariusz.zaborski@klarasystems.com>
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Closes #16853
This commit is contained in:
Mariusz Zaborski
2025-08-06 19:31:21 +02:00
committed by GitHub
parent c3496b5cc6
commit 894edd084e
21 changed files with 736 additions and 10 deletions
+15
View File
@@ -2246,6 +2246,21 @@ Defer frees starting in this pass.
Maximum memory used for prefetching a checkpoint's space map on each
vdev while discarding the checkpoint.
.
.It Sy zfs_spa_note_txg_time Ns = Ns Sy 600 Pq uint
This parameter defines, in seconds, how often the TXG time database will record
a new TXG if it has changed.
After the specified time interval has passed, and if the TXG number has changed,
the new value is recorded in the database.
These timestamps can later be used for more granular operations, such as
scrubbing.
.
.It Sy zfs_spa_flush_txg_time Ns = Ns Sy 600 Pq uint
This parameter defines, in seconds, how often the ZFS will flush
the TXG time database to disk.
It ensures that the data is actually written to persistent storage, which helps
preserve the database in case of unexpected shutdown.
The database is also automatically flushed during the export sequence.
.
.It Sy zfs_special_class_metadata_reserve_pct Ns = Ns Sy 25 Ns % Pq uint
Only allow small data blocks to be allocated on the special and dedup vdev
types when the available free space percentage on these vdevs exceeds this
+41 -1
View File
@@ -28,7 +28,7 @@
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\" Copyright (c) 2025 Hewlett Packard Enterprise Development LP.
.\"
.Dd November 18, 2024
.Dd December 11, 2024
.Dt ZPOOL-SCRUB 8
.Os
.
@@ -40,6 +40,8 @@
.Cm scrub
.Op Ns Fl e | Ns Fl p | Fl s Ns | Fl C Ns
.Op Fl w
.Op Fl S Ar date
.Op Fl E Ar date
.Fl a Ns | Ns Ar pool Ns …
.
.Sh DESCRIPTION
@@ -125,6 +127,44 @@ resilvering, nor can it be run when a regular scrub is paused.
Continue scrub from last saved txg (see zpool
.Sy last_scrubbed_txg
property).
.It Fl S Ar date , Fl E Ar date
Allows specifying the date range for blocks created between these dates.
.Bl -bullet -compact -offset indent
.It
.Fl S
Defines a start date.
If not specified, scrubbing begins from the start of the pool's
existence.
.It
.Fl E
Defines an end date.
If not specified, scrubbing continues up to the most recent data.
.El
The provided date should be in the format:
.Dq YYYY-MM-DD HH:MM .
Where:
.Bl -bullet -compact -offset indent
.It
.Dq YYYY
is the year.
.It
.Dq MM
is the numeric representation of the month.
.It
.Dq DD
is the day of the month.
.It
.Dq HH
is the hour.
.It
.Dq MM
is the minutes.
.El
The hour and minutes parameters can be omitted.
The time should be provided in machine local time zone.
Specifying dates prior to enabling this feature will result in scrubbing
starting from the date the pool was created.
If the time was moved backward manually the data range may become inaccurate.
.El
.Sh EXAMPLES
.Ss Example 1