From cc76e6876bfbcbd83b004322a2c747afb710b7b1 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Sun, 28 Jan 2024 14:59:33 +0300 Subject: [PATCH] Fix flapping "scrub" test --- tests/test_scrub.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_scrub.sh b/tests/test_scrub.sh index 9da65a0c..8252e0bd 100755 --- a/tests/test_scrub.sh +++ b/tests/test_scrub.sh @@ -20,6 +20,9 @@ LD_PRELOAD="build/src/libfio_vitastor.so" \ fio -thread -name=test -ioengine=build/src/libfio_vitastor.so -bs=1M -direct=1 -iodepth=4 \ -mirror_file=./testdata/mirror.bin -end_fsync=1 -rw=write -etcd=$ETCD_URL -image=testimg +# Save PG primary +primary=$($ETCDCTL get --print-value-only /vitastor/config/pgs | jq -r '.items["1"]["1"].primary') + # Intentionally corrupt OSD data and restart it zero_osd_pid=OSD${ZERO_OSD}_PID kill ${!zero_osd_pid} @@ -34,6 +37,9 @@ start_osd $ZERO_OSD # Wait until start wait_up 10 +# Wait until PG is back on the same primary +wait_condition 10 "$ETCDCTL"$' get --print-value-only /vitastor/config/pgs | jq -s -e \'.[0].items["1"]["1"].primary == "'$primary'"'"'" + # Trigger scrub $ETCDCTL put /vitastor/pg/history/1/1 `$ETCDCTL get --print-value-only /vitastor/pg/history/1/1 | jq -s -c '(.[0] // {}) + {"next_scrub":1}'`