From ea4f32a5bc65de3ce377ea1afba713cd7780f6b5 Mon Sep 17 00:00:00 2001 From: Nitzan Mordechai Date: Sun, 4 Jun 2023 08:28:56 +0000 Subject: [PATCH] test: Divergent test 3 with pg_autoscale_mode on pick divergent osd 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 (cherry picked from commit 13c640b5a82bf8f9b1aa5619416a4dbbb5d9a8d0) --- qa/standalone/osd/divergent-priors.sh | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/qa/standalone/osd/divergent-priors.sh b/qa/standalone/osd/divergent-priors.sh index dec0e7ad4e1..40d72544d1b 100755 --- a/qa/standalone/osd/divergent-priors.sh +++ b/qa/standalone/osd/divergent-priors.sh @@ -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 -- 2.39.5