seawinde commented on code in PR #61290:
URL: https://github.com/apache/doris/pull/61290#discussion_r2979902242
##########
regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy:
##########
@@ -2160,60 +2183,117 @@ class Suite implements GroovyInterceptable {
}
void waitingMTMVTaskFinished(String jobName) {
+ // Wait for the newly submitted MTMV task to become visible in tasks().
Thread.sleep(2000);
- String showTasks = "select
TaskId,JobId,JobName,MvId,Status,MvName,MvDatabaseName,ErrorMsg from
tasks('type'='mv') where JobName = '${jobName}' order by CreateTime ASC"
+ String showTasks = """
+ select TaskId, Status, MvName, MvDatabaseName from
tasks('type'='mv')
+ where JobName = '${jobName}' order by CreateTime DESC limit 1
+ """
String status = "NULL"
List<List<Object>> result
- long startTime = System.currentTimeMillis()
- long timeoutTimestamp = startTime + 5 * 60 * 1000 // 5 min
+ long timeoutTimestamp = System.currentTimeMillis() + 5 * 60 * 1000 //
5 min
+ String lastLoggedStatus = null
+ List<Object> taskRow = null
do {
result = sql(showTasks)
- logger.info("result: " + result.toString())
- if (!result.isEmpty()) {
- status = result.last().get(4)
+ if (result.isEmpty()) {
+ if (lastLoggedStatus != "NULL") {
+ logger.info("waitingMTMVTaskFinished task row is empty")
+ lastLoggedStatus = "NULL"
+ }
+ status = "NULL"
+ } else {
+ taskRow = result[0]
+ status = taskRow.get(1).toString()
+ if (lastLoggedStatus != status) {
+ logger.info("The state of ${showTasks} is ${status},
taskId is ${taskRow.get(0)}")
+ lastLoggedStatus = status
+ }
+ }
+ if (status == 'PENDING' || status == 'RUNNING' || status ==
'NULL') {
+ Thread.sleep(500);
}
- logger.info("The state of ${showTasks} is ${status}")
- Thread.sleep(1000);
} while (timeoutTimestamp > System.currentTimeMillis() && (status ==
'PENDING' || status == 'RUNNING' || status == 'NULL'))
if (status != "SUCCESS") {
logger.info("status is not success")
}
Assert.assertEquals("SUCCESS", status)
// Need to analyze materialized view for cbo to choose the
materialized view accurately
- def show_tables = sql """
- show tables from ${result.last().get(6)};
- """
- def db_id = getDbId(result.last().get(6))
- def table_id = getTableId(result.last().get(6), result.last().get(5))
- logger.info("waitingMTMVTaskFinished analyze mv name is " +
result.last().get(5)
- + ", db name is " + result.last().get(6)
- + ", show_tables are " + show_tables
- + ", db_id is " + db_id
- + ", table_id " + table_id)
- sql "analyze table ${result.last().get(6)}.${result.last().get(5)}
with sync;"
- String db = result.last().get(6)
- String table = result.last().get(5)
- result = sql("show table stats ${db}.${table}")
- logger.info("table stats: " + result.toString())
- result = sql("show index stats ${db}.${table} ${table}")
- logger.info("index stats: " + result.toString())
+ logger.info("waitingMTMVTaskFinished analyze mv name is " +
taskRow.get(2)
+ + ", db name is " + taskRow.get(3)
+ + ", task id is " + taskRow.get(0))
+ sql "analyze table ${taskRow.get(3)}.${taskRow.get(2)} with sync;"
+ }
+
+ void waitingMTMVTaskFinishedWithoutAnalyze(String jobName) {
+ // Wait for the newly submitted MTMV task to become visible in tasks().
+ Thread.sleep(2000);
Review Comment:
What if it is still not visible within 2 seconds?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]