Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions module/zfs/zfs_crrd.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ dbrrd_add(dbrrd_t *db, hrtime_t time, uint64_t txg)
daydiff = time - rrd_tail(&db->dbr_days);
monthdiff = time - rrd_tail(&db->dbr_months);

if (monthdiff >= 0 && monthdiff >= SEC2NSEC(30 * 24 * 60 * 60))
if (monthdiff >= 0 && monthdiff >= 30 * 24 * 60 * 60)
rrd_add(&db->dbr_months, time, txg);
else if (daydiff >= 0 && daydiff >= SEC2NSEC(24 * 60 * 60))
else if (daydiff >= 0 && daydiff >= 24 * 60 * 60)
rrd_add(&db->dbr_days, time, txg);
else if (minutedif >= 0)
rrd_add(&db->dbr_minutes, time, txg);
Expand Down
2 changes: 1 addition & 1 deletion tests/runfiles/common.run
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ tests = ['zpool_scrub_001_neg', 'zpool_scrub_002_pos', 'zpool_scrub_003_pos',
'zpool_scrub_multiple_pools',
'zpool_error_scrub_001_pos', 'zpool_error_scrub_002_pos',
'zpool_error_scrub_003_pos', 'zpool_error_scrub_004_pos',
'zpool_scrub_date_range_001']
'zpool_scrub_date_range_001', 'zpool_scrub_date_range_002']
tags = ['functional', 'cli_root', 'zpool_scrub']

[tests/functional/cli_root/zpool_set]
Expand Down
1 change: 1 addition & 0 deletions tests/zfs-tests/include/tunables.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ SPA_DISCARD_MEMORY_LIMIT spa.discard_memory_limit zfs_spa_discard_memory_limit
SPA_LOAD_VERIFY_DATA spa.load_verify_data spa_load_verify_data
SPA_LOAD_VERIFY_METADATA spa.load_verify_metadata spa_load_verify_metadata
SPA_NOTE_TXG_TIME spa.note_txg_time spa_note_txg_time
SPA_FLUSH_TXG_TIME spa.flush_txg_time spa_flush_txg_time
TRIM_EXTENT_BYTES_MIN trim.extent_bytes_min zfs_trim_extent_bytes_min
TRIM_METASLAB_SKIP trim.metaslab_skip zfs_trim_metaslab_skip
TRIM_TXG_BATCH trim.txg_batch zfs_trim_txg_batch
Expand Down
1 change: 1 addition & 0 deletions tests/zfs-tests/tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -1251,6 +1251,7 @@ nobase_dist_datadir_zfs_tests_tests_SCRIPTS += \
functional/cli_root/zpool_scrub/zpool_scrub_print_repairing.ksh \
functional/cli_root/zpool_scrub/zpool_scrub_txg_continue_from_last.ksh \
functional/cli_root/zpool_scrub/zpool_scrub_date_range_001.ksh \
functional/cli_root/zpool_scrub/zpool_scrub_date_range_002.ksh \
functional/cli_root/zpool_scrub/zpool_error_scrub_001_pos.ksh \
functional/cli_root/zpool_scrub/zpool_error_scrub_002_pos.ksh \
functional/cli_root/zpool_scrub/zpool_error_scrub_003_pos.ksh \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/bin/ksh -p
# SPDX-License-Identifier: CDDL-1.0
#
# 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 2025 Klara, Inc.
#

. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/cli_root/zpool_scrub/zpool_scrub.cfg

#
# DESCRIPTION:
# Verify that the timestamp database updates all the tables as expected.
#
# STRATEGY:
# 1. Decrease the note and flush frequency of the txg database.
# 2. Force the pool to sync several txgs
# 3. Verify that there are entries in each of the "month", "day", and
# "minute" tables.
#

verify_runnable "global"

function cleanup
{
log_must restore_tunable SPA_NOTE_TXG_TIME
log_must restore_tunable SPA_FLUSH_TXG_TIME
rm /$TESTPOOL/f1
}

log_onexit cleanup

log_assert "Verifiy timestamp databases all update as expected."

log_must save_tunable SPA_NOTE_TXG_TIME
log_must set_tunable64 SPA_NOTE_TXG_TIME 1
log_must save_tunable SPA_FLUSH_TXG_TIME
log_must set_tunable64 SPA_FLUSH_TXG_TIME 1

log_must touch /$TESTPOOL/f1
log_must zpool sync $TESTPOOL
sleep 1
log_must touch /$TESTPOOL/f1
log_must zpool sync $TESTPOOL
sleep 1
log_must touch /$TESTPOOL/f1
log_must zpool sync $TESTPOOL

mos_zap="$(zdb -dddd $TESTPOOL 1)"
minutes_entries=$(echo "$mos_zap" | grep "txg_log_time:minutes" | awk '{print $5}')
days_entries=$(echo "$mos_zap" | grep "txg_log_time:days" | awk '{print $5}')
months_entries=$(echo "$mos_zap" | grep "txg_log_time:months" | awk '{print $5}')

[[ "$minutes_entries" -ne "0" ]] || log_fail "0 entries in the minutes table"
[[ "$days_entries" -ne "0" ]] || log_fail "0 entries in the days table"
[[ "$months_entries" -ne "0" ]] || log_fail "0 entries in the months table"

log_pass "Verified all timestamp databases had entries as expected."
Loading