Skip to content

Commit

Permalink
ZTS: Retry in import_rewind_config_changed.ksh
Browse files Browse the repository at this point in the history
As explained by the disclaimer in the test case,

    "This test can fail since nothing guarantees that old
    MOS blocks aren't overwritten."

This behavior is expected and correct, but results in a
flaky test case which is problematic for the CI.  The best
we can do to resolve this is to retry the sub-test which
failed when the MOS blocks have clearly been overwritten.

When testing failures were rare enough that a single retry
should normally be sufficient.  However, we allow up to
five for good measure.

Reviewed by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes openzfs#13119
  • Loading branch information
behlendorf authored and tonyhutter committed Mar 2, 2022
1 parent e2fddf0 commit 190516f
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 11 deletions.
2 changes: 0 additions & 2 deletions tests/test-runner/bin/zts-report.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,6 @@ maybe = {
'cli_root/zfs_unshare/setup': ['SKIP', share_reason],
'cli_root/zpool_add/zpool_add_004_pos': ['FAIL', known_reason],
'cli_root/zpool_destroy/zpool_destroy_001_pos': ['SKIP', '6145'],
'cli_root/zpool_import/import_rewind_config_changed':
['FAIL', rewind_reason],
'cli_root/zpool_import/zpool_import_missing_003_pos': ['SKIP', '6839'],
'cli_root/zpool_initialize/zpool_initialize_import_export':
['FAIL', '11948'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ function test_common
typeset detachvdev="${4:-}"
typeset removevdev="${5:-}"
typeset finalpool="${6:-}"
typeset retval=1

typeset poolcheck="$poolcreate"

Expand Down Expand Up @@ -120,19 +121,30 @@ function test_common
# while having a checkpoint, we take it after the
# operation that changes the config.
#
# However, it is possible the MOS data was overwritten
# in which case the pool will either be unimportable, or
# may have been rewound prior to the data being written.
# In which case an error is returned and test_common()
# is retried by the caller to minimize false positives.
#
log_must zpool checkpoint $TESTPOOL1

log_must overwrite_data $TESTPOOL1 ""

log_must zpool export $TESTPOOL1

log_must zpool import -d $DEVICE_DIR -T $txg $TESTPOOL1
log_must check_pool_config $TESTPOOL1 "$poolcheck"
zpool import -d $DEVICE_DIR -T $txg $TESTPOOL1
if (( $? == 0 )); then
verify_data_md5sums $MD5FILE
if (( $? == 0 )); then
retval=0
fi

log_must verify_data_md5sums $MD5FILE
log_must check_pool_config $TESTPOOL1 "$poolcheck"
log_must zpool destroy $TESTPOOL1
fi

# Cleanup
log_must zpool destroy $TESTPOOL1
if [[ -n $pathstochange ]]; then
for dev in $pathstochange; do
log_must mv "${dev}_new" $dev
Expand All @@ -143,6 +155,7 @@ function test_common
log_must zpool destroy $TESTPOOL2

log_note ""
return $retval
}

function test_add_vdevs
Expand All @@ -152,7 +165,12 @@ function test_add_vdevs

log_note "$0: pool '$poolcreate', add $addvdevs."

test_common "$poolcreate" "$addvdevs"
for retry in $(seq 1 5); do
test_common "$poolcreate" "$addvdevs" && return
log_note "Retry $retry / 5 for test_add_vdevs()"
done

log_fail "Exhausted all 5 retries for test_add_vdevs()"
}

function test_attach_vdev
Expand All @@ -163,7 +181,12 @@ function test_attach_vdev

log_note "$0: pool '$poolcreate', attach $attachvdev to $attachto."

test_common "$poolcreate" "" "$attachto $attachvdev"
for retry in $(seq 1 5); do
test_common "$poolcreate" "" "$attachto $attachvdev" && return
log_note "Retry $retry / 5 for test_attach_vdev()"
done

log_fail "Exhausted all 5 retries for test_attach_vdev()"
}

function test_detach_vdev
Expand All @@ -173,7 +196,12 @@ function test_detach_vdev

log_note "$0: pool '$poolcreate', detach $detachvdev."

test_common "$poolcreate" "" "" "$detachvdev"
for retry in $(seq 1 5); do
test_common "$poolcreate" "" "" "$detachvdev" && return
log_note "Retry $retry / 5 for test_detach_vdev()"
done

log_fail "Exhausted all 5 retries for test_detach_vdev()"
}

function test_attach_detach_vdev
Expand All @@ -186,7 +214,13 @@ function test_attach_detach_vdev
log_note "$0: pool '$poolcreate', attach $attachvdev to $attachto," \
"then detach $detachvdev."

test_common "$poolcreate" "" "$attachto $attachvdev" "$detachvdev"
for retry in $(seq 1 5); do
test_common "$poolcreate" "" "$attachto $attachvdev" \
"$detachvdev" && return
log_note "Retry $retry / 5 for test_attach_detach_vdev()"
done

log_fail "Exhausted all 5 retries for test_attach_detach_vdev()"
}

function test_remove_vdev
Expand All @@ -197,7 +231,13 @@ function test_remove_vdev

log_note "$0: pool '$poolcreate', remove $removevdev."

test_common "$poolcreate" "" "" "" "$removevdev" "$finalpool"
for retry in $(seq 1 5); do
test_common "$poolcreate" "" "" "" "$removevdev" \
"$finalpool" && return
log_note "Retry $retry / 5 for test_remove_vdev()"
done

log_fail "Exhausted all 5 retries for test_remove_vdev()"
}

# Record txg history
Expand Down

0 comments on commit 190516f

Please sign in to comment.