Skip to content

Commit

Permalink
Improve analyze mv/mtmv wait row count report logic. (apache#33695)
Browse files Browse the repository at this point in the history
Jibing-Li authored Apr 17, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 3e0d275 commit d810269
Showing 2 changed files with 19 additions and 6 deletions.
11 changes: 8 additions & 3 deletions regression-test/suites/statistics/test_analyze_mtmv.groovy
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@

suite("test_analyze_mtmv") {

def wait_row_count_reported = { db, table, expected ->
def wait_row_count_reported = { db, table, row, column, expected ->
def result = sql """show frontends;"""
logger.info("show frontends result origin: " + result)
def host
@@ -39,7 +39,7 @@ suite("test_analyze_mtmv") {
Thread.sleep(5000)
result = sql """SHOW DATA FROM ${table};"""
logger.info("result " + result)
if (result[0][4] == expected) {
if (result[row][column] == expected) {
return;
}
}
@@ -287,7 +287,12 @@ suite("test_analyze_mtmv") {
result_sample = sql """show column cached stats mv1(sum_total)"""
assertEquals(0, result_sample.size())

wait_row_count_reported("test_analyze_mtmv", "mv1", "3")
try {
wait_row_count_reported("test_analyze_mtmv", "mv1", 0, 4, "3")
} catch (Exception e) {
logger.info(e.getMessage());
return;
}
sql """analyze table mv1 with sync with sample rows 4000000"""
result_sample = sql """show column stats mv1(l_shipdate)"""
logger.info("result " + result_sample)
14 changes: 11 additions & 3 deletions regression-test/suites/statistics/test_analyze_mv.groovy
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ suite("test_analyze_mv") {
throw new Exception("Wait mv finish timeout.")
}

def wait_row_count_reported = { db, table, expected ->
def wait_row_count_reported = { db, table, row, column, expected ->
def result = sql """show frontends;"""
logger.info("show frontends result origin: " + result)
def host
@@ -57,7 +57,7 @@ suite("test_analyze_mv") {
Thread.sleep(5000)
result = sql """SHOW DATA FROM ${table};"""
logger.info("result " + result)
if (result[3][4] == expected) {
if (result[row][column] == expected) {
return;
}
}
@@ -424,7 +424,15 @@ suite("test_analyze_mv") {
assertEquals(0, result_sample.size())

// Test sample
wait_row_count_reported("test_analyze_mv", "mvTestDup", "6")
try {
wait_row_count_reported("test_analyze_mv", "mvTestDup", 0, 4, "6")
wait_row_count_reported("test_analyze_mv", "mvTestDup", 1, 4, "6")
wait_row_count_reported("test_analyze_mv", "mvTestDup", 2, 4, "4")
wait_row_count_reported("test_analyze_mv", "mvTestDup", 3, 4, "6")
} catch (Exception e) {
logger.info(e.getMessage());
return;
}
sql """analyze table mvTestDup with sample rows 4000000"""
wait_analyze_finish("mvTestDup")
result_sample = sql """SHOW ANALYZE mvTestDup;"""

0 comments on commit d810269

Please sign in to comment.