Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UT] fix unstable ut (backport #46617) #46629

Merged
merged 2 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions test/lib/sr_sql_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -994,3 +994,16 @@ def check_es_table_metadata_ready(self, table_name):
time.sleep(10)
count += 1
tools.assert_true(False, "check es table metadata 600s timeout")

def assert_clear_stale_stats(self, query, expect_num):
timeout = 300
num = 0;
while timeout > 0:
res = self.execute_sql(query)
num = res["result"]
if int(num) < expect_num:
break;
time.sleep(10)
timeout -= 10
else:
tools.assert_true(False, "clear stale column stats timeout. The number of stale column stats is %s" % num)
8 changes: 2 additions & 6 deletions test/sql/test_refresh_statistics/R/test_clear_stats
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,9 @@ analyze table test_clear_stats.tbl WITH SYNC MODE;
-- result:
test_clear_stats.tbl analyze status OK
-- !result
select sleep(80);
function: assert_clear_stale_stats("select count(*) from _statistics_.column_statistics where table_name = 'test_clear_stats.tbl'", 3)
-- result:
1
-- !result
select count(*) <= 3 from _statistics_.column_statistics where table_name = 'test_clear_stats.tbl';
-- result:
1
None
-- !result
ADMIN SET FRONTEND CONFIG ("clear_stale_stats_interval_sec" = "43200");
-- result:
Expand Down
5 changes: 1 addition & 4 deletions test/sql/test_refresh_statistics/T/test_clear_stats
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,8 @@ analyze table test_clear_stats.tbl WITH SYNC MODE;
truncate table tbl;
insert into tbl values (1, 1), (2, 2), (3, 3), (4, 4);
analyze table test_clear_stats.tbl WITH SYNC MODE;
select sleep(80);
select count(*) <= 3 from _statistics_.column_statistics where table_name = 'test_clear_stats.tbl';
function: assert_clear_stale_stats("select count(*) from _statistics_.column_statistics where table_name = 'test_clear_stats.tbl'", 3)
ADMIN SET FRONTEND CONFIG ("clear_stale_stats_interval_sec" = "43200");
ADMIN SET FRONTEND CONFIG ("statistic_manager_sleep_time_sec" = "60");




Loading