Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion test/new_test_framework/utils/tmqUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,18 @@ def splitVgroups(self):
tdSql.query(splitSql)

def checkSplitVgroups(self):
cnt = 0
while True:
tdSql.query("select * from information_schema.ins_vnodes where db_name='dbt' and status='leader' and restored=true")
tdLog.info(tdSql.queryResult)
if tdSql.getRows() == 2:
Comment on lines 87 to 89
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This loop logs tdSql.queryResult at INFO on every poll; in this repo, raw queryResult dumps are typically logged at DEBUG to avoid noisy CI logs (see test/new_test_framework/utils/clusterCommonCheck.py where tdLog.debug(tdSql.queryResult) is used). Consider switching this to tdLog.debug(...) and, since you only use the row count, querying select count(*) instead of select * to reduce output and query overhead.

Suggested change
tdSql.query("select * from information_schema.ins_vnodes where db_name='dbt' and status='leader' and restored=true")
tdLog.info(tdSql.queryResult)
if tdSql.getRows() == 2:
tdSql.query("select count(*) from information_schema.ins_vnodes where db_name='dbt' and status='leader' and restored=true")
tdLog.debug(tdSql.queryResult)
if tdSql.queryResult[0][0] == 2:

Copilot uses AI. Check for mistakes.
cnt += 1
Comment on lines 86 to +90
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkSplitVgroups() can loop forever if the expected vnode state is never reached (e.g., split fails or the environment differs), which can hang the entire test run. Please add a bounded timeout/retry limit and fail fast (e.g., tdLog.exit(...) with the last observed rows/result) similar to other cluster wait helpers that cap retries (e.g., ClusterComCheck.check_vgroups_status() uses count < count_number and exits on failure).

Copilot uses AI. Check for mistakes.
else:
cnt = 0
if cnt >= 10:
Comment on lines 89 to +93
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requiring tdSql.getRows() == 2 to be observed 10 consecutive times plus sleep(2) makes this wait at least ~20s after the condition first becomes true, and it will noticeably slow multiple TMQ vnode-split tests that call this helper. If the intent is to avoid transient states, consider waiting for a stability duration (e.g., condition true for N seconds) with a small poll interval, or using a smaller consecutive-count threshold, so successful splits don't always pay the extra 20s.

Copilot uses AI. Check for mistakes.
break
tdLog.info("wait vgroup split done...")
time.sleep(1)
time.sleep(2)
tdLog.info("splitSql ok")

def redistributeVgroups(self):
Expand Down
Loading