Skip to content

Commit f43d9d9

Browse files
authored
[Test](count on index) enhance count on index case retrying for statistics #42699 (#42887)
cherry pick from #42699
1 parent ab0a7c8 commit f43d9d9

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

regression-test/suites/inverted_index_p0/test_count_on_index.groovy

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,31 @@ suite("test_count_on_index_httplogs", "p0") {
145145
sql """set experimental_enable_nereids_planner=true;"""
146146
sql """set enable_fallback_to_original_planner=false;"""
147147
sql """analyze table ${testTable_dup} with sync""";
148-
// wait BE report every partition's row count
149-
sleep(10000)
150148
// case1: test duplicate table
149+
def maxRetries = 3
150+
def attempt = 0
151+
def success = false
152+
153+
while (attempt < maxRetries && !success) {
154+
try {
155+
explain {
156+
sleep(10000)
157+
sql("select COUNT() from ${testTable_dup}")
158+
notContains("cardinality=0")
159+
}
160+
success = true
161+
} catch (Exception e) {
162+
attempt++
163+
log.error("Attempt ${attempt} failed: ${e.message}")
164+
if (attempt < maxRetries) {
165+
log.info("Retrying... (${attempt + 1}/${maxRetries})")
166+
sleep(1000)
167+
} else {
168+
log.error("All ${maxRetries} attempts failed.")
169+
throw e
170+
}
171+
}
172+
}
151173
explain {
152174
sql("select COUNT() from ${testTable_dup} where request match 'GET'")
153175
contains "pushAggOp=COUNT_ON_INDEX"

0 commit comments

Comments
 (0)