5 # This file and its contents are supplied under the terms of the
6 # Common Development and Distribution License ("CDDL"), version 1.0.
7 # You may only use this file in accordance with the terms of version
10 # A full copy of the text of the CDDL should have accompanied this
11 # source. A copy of the CDDL is also available via the Internet at
12 # http://www.illumos.org/license/CDDL.
18 # Copyright (c) 2017 by Lawrence Livermore National Security, LLC.
22 # Ensure that MMP updates uberblocks with MMP info at expected intervals.
25 # 1. Set TXG_TIMEOUT to large value
27 # 3. Clear multihost history
28 # 4. Sleep, then collect count of uberblocks written
29 # 5. If number of changes seen is less than min threshold, then fail
30 # 6. If number of changes seen is more than max threshold, then fail
31 # 7. Sequence number increments when no TXGs are syncing
34 . $STF_SUITE/include/libtest.shlib
35 . $STF_SUITE/tests/functional/mmp/mmp.cfg
36 . $STF_SUITE/tests/functional/mmp/mmp.kshlib
38 verify_runnable "both"
41 EXPECTED=$(($(echo $DISKS | wc -w) * 10))
42 FUDGE=$((EXPECTED * 20 / 100))
43 MIN_UB_WRITES=$((EXPECTED - FUDGE))
44 MAX_UB_WRITES=$((EXPECTED + FUDGE))
49 default_cleanup_noexit
50 log_must set_tunable64 MULTIHOST_INTERVAL $MMP_INTERVAL_DEFAULT
51 set_tunable64 TXG_TIMEOUT $TXG_TIMEOUT_DEFAULT
52 log_must mmp_clear_hostid
55 log_assert "Ensure MMP uberblocks update at the correct interval"
58 log_must set_tunable64 TXG_TIMEOUT $TXG_TIMEOUT_LONG
59 log_must mmp_set_hostid $HOSTID1
61 default_setup_noexit "$DISKS"
62 log_must zpool set multihost=on $TESTPOOL
64 UBER_CHANGES=$(count_mmp_writes $TESTPOOL 10)
66 log_note "Uberblock changed $UBER_CHANGES times"
68 if [ $UBER_CHANGES -lt $MIN_UB_WRITES ]; then
69 log_fail "Fewer uberblock writes occurred than expected ($EXPECTED)"
72 if [ $UBER_CHANGES -gt $MAX_UB_WRITES ]; then
73 log_fail "More uberblock writes occurred than expected ($EXPECTED)"
76 log_must set_tunable64 MULTIHOST_INTERVAL $MMP_INTERVAL_MIN
77 SEQ_BEFORE=$(zdb -luuuu ${DISK[0]} | awk '/mmp_seq/ {if ($NF>max) max=$NF}; END {print max}')
79 SEQ_AFTER=$(zdb -luuuu ${DISK[0]} | awk '/mmp_seq/ {if ($NF>max) max=$NF}; END {print max}')
80 if [ $((SEQ_AFTER - SEQ_BEFORE)) -lt $MIN_SEQ_VALUES ]; then
82 log_fail "ERROR: mmp_seq did not increase by $MIN_SEQ_VALUES; before $SEQ_BEFORE after $SEQ_AFTER"
85 log_pass "Ensure MMP uberblocks update at the correct interval passed"