|
| 1 | +#!/bin/ksh -p |
| 2 | +# SPDX-License-Identifier: CDDL-1.0 |
| 3 | +# |
| 4 | +# CDDL HEADER START |
| 5 | +# |
| 6 | +# The contents of this file are subject to the terms of the |
| 7 | +# Common Development and Distribution License (the "License"). |
| 8 | +# You may not use this file except in compliance with the License. |
| 9 | +# |
| 10 | +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
| 11 | +# or https://opensource.org/licenses/CDDL-1.0. |
| 12 | +# See the License for the specific language governing permissions |
| 13 | +# and limitations under the License. |
| 14 | +# |
| 15 | +# When distributing Covered Code, include this CDDL HEADER in each |
| 16 | +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
| 17 | +# If applicable, add the following below this CDDL HEADER, with the |
| 18 | +# fields enclosed by brackets "[]" replaced with your own identifying |
| 19 | +# information: Portions Copyright [yyyy] [name of copyright owner] |
| 20 | +# |
| 21 | +# CDDL HEADER END |
| 22 | +# |
| 23 | +# Copyright 2025 Klara, Inc. |
| 24 | +# |
| 25 | + |
| 26 | +. $STF_SUITE/include/libtest.shlib |
| 27 | +. $STF_SUITE/tests/functional/cli_root/zpool_scrub/zpool_scrub.cfg |
| 28 | + |
| 29 | +# |
| 30 | +# DESCRIPTION: |
| 31 | +# Verify that the timestamp database updates all the tables as expected. |
| 32 | +# |
| 33 | +# STRATEGY: |
| 34 | +# 1. Decrease the note and flush frequency of the txg database. |
| 35 | +# 2. Force the pool to sync several txgs |
| 36 | +# 3. Verify that there are entries in each of the "month", "day", and |
| 37 | +# "minute" tables. |
| 38 | +# |
| 39 | + |
| 40 | +verify_runnable "global" |
| 41 | + |
| 42 | +function cleanup |
| 43 | +{ |
| 44 | + log_must restore_tunable SPA_NOTE_TXG_TIME |
| 45 | + log_must restore_tunable SPA_FLUSH_TXG_TIME |
| 46 | + rm /$TESTPOOL/f1 |
| 47 | +} |
| 48 | + |
| 49 | +log_onexit cleanup |
| 50 | + |
| 51 | +log_assert "Verifiy timestamp databases all update as expected." |
| 52 | + |
| 53 | +log_must save_tunable SPA_NOTE_TXG_TIME |
| 54 | +log_must set_tunable64 SPA_NOTE_TXG_TIME 1 |
| 55 | +log_must save_tunable SPA_FLUSH_TXG_TIME |
| 56 | +log_must set_tunable64 SPA_FLUSH_TXG_TIME 1 |
| 57 | + |
| 58 | +log_must touch /$TESTPOOL/f1 |
| 59 | +log_must zpool sync $TESTPOOL |
| 60 | +sleep 1 |
| 61 | +log_must touch /$TESTPOOL/f1 |
| 62 | +log_must zpool sync $TESTPOOL |
| 63 | +sleep 1 |
| 64 | +log_must touch /$TESTPOOL/f1 |
| 65 | +log_must zpool sync $TESTPOOL |
| 66 | + |
| 67 | +mos_zap="$(zdb -dddd $TESTPOOL 1)" |
| 68 | +minutes_entries=$(echo "$mos_zap" | grep "txg_log_time:minutes" | awk '{print $5}') |
| 69 | +days_entries=$(echo "$mos_zap" | grep "txg_log_time:days" | awk '{print $5}') |
| 70 | +months_entries=$(echo "$mos_zap" | grep "txg_log_time:months" | awk '{print $5}') |
| 71 | + |
| 72 | +[[ "$minutes_entries" -ne "0" ]] || log_fail "0 entries in the minutes table" |
| 73 | +[[ "$days_entries" -ne "0" ]] || log_fail "0 entries in the days table" |
| 74 | +[[ "$months_entries" -ne "0" ]] || log_fail "0 entries in the months table" |
| 75 | + |
| 76 | +log_pass "Verified all timestamp databases had entries as expected." |
0 commit comments