]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test: Divergent test 3 with pg_autoscale_mode on pick divergent osd
authorNitzan Mordechai <nmordech@redhat.com>
Sun, 4 Jun 2023 08:28:56 +0000 (08:28 +0000)
committerNitzanMordhai <nmordech@redhat.com>
Tue, 1 Aug 2023 05:12:12 +0000 (05:12 +0000)
When creating new pool, the current code pick the divergent osd by
the first pg out of pg dump pgs, that can be in "unknown" status
which means the up_primary = -1 and that will fail the test.
We need to wait unitl the first pg is active+clean

Fixes: https://tracker.ceph.com/issues/56034
Signed-off-by: Nitzan Mordechai <nmordech@redhat.com>
(cherry picked from commit 13c640b5a82bf8f9b1aa5619416a4dbbb5d9a8d0)

qa/standalone/osd/divergent-priors.sh

index dec0e7ad4e1bca0d048fbbf4495bf309a1fcf804..40d72544d1b062b1b17f0677ccd8f25bef3ffe59 100755 (executable)
@@ -650,13 +650,28 @@ function TEST_divergent_3() {
     # reproduce https://tracker.ceph.com/issues/41816
     ceph osd pool set $poolname pg_autoscale_mode on
 
-    flush_pg_stats || return 1
-    wait_for_clean || return 1
+    divergent=-1
+    start_time=$(date +%s)
+    max_duration=300
+
+    while [ "$divergent" -le -1 ]
+      do
+        flush_pg_stats || return 1
+        wait_for_clean || return 1
+
+        # determine primary
+        divergent="$(ceph pg dump pgs --format=json | jq '.pg_stats[0].up_primary')"
+        echo "primary and soon to be divergent is $divergent"
+        ceph pg dump pgs
+
+        current_time=$(date +%s)
+        elapsed_time=$(expr $current_time - $start_time)
+        if [ "$elapsed_time" -gt "$max_duration" ]; then
+          echo "timed out waiting for divergent"
+          return 1
+        fi
+    done
 
-    # determine primary
-    local divergent="$(ceph pg dump pgs --format=json | jq '.pg_stats[0].up_primary')"
-    echo "primary and soon to be divergent is $divergent"
-    ceph pg dump pgs
     local non_divergent=""
     for i in $osds
     do