seawinde commented on code in PR #61290:
URL: https://github.com/apache/doris/pull/61290#discussion_r2979887598
##########
regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy:
##########
@@ -2030,94 +2026,121 @@ class Suite implements GroovyInterceptable {
}
def waitingMTMVTaskFinishedByMvName = { mvName, dbName = context.dbName ->
+ // 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 MvDatabaseName = '${dbName}' and MvName = '${mvName}'
order by CreateTime ASC"
+ String showTasks = """
+ select TaskId, Status, MvName, MvDatabaseName from
tasks('type'='mv')
+ where MvDatabaseName = '${dbName}' and MvName = '${mvName}'
+ 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
- List<String> toCheckTaskRow = new ArrayList<>();
+ long timeoutTimestamp = System.currentTimeMillis() + 5 * 60 * 1000 //
5 min
+ String lastLoggedStatus = null
+ List<Object> toCheckTaskRow = null
while (timeoutTimestamp > System.currentTimeMillis() && (status ==
'PENDING' || status == 'RUNNING' || status == 'NULL')) {
result = sql(showTasks)
- logger.info("current db is " + dbName + ", showTasks is " +
result.toString())
if (result.isEmpty()) {
- logger.info("waitingMTMVTaskFinishedByMvName toCheckTaskRow is
empty")
- Thread.sleep(1000);
+ if (lastLoggedStatus != "NULL") {
+ logger.info("waitingMTMVTaskFinishedByMvName
toCheckTaskRow is empty")
+ lastLoggedStatus = "NULL"
+ }
+ Thread.sleep(500);
continue;
}
- toCheckTaskRow = result.last();
- status = toCheckTaskRow.get(4)
- logger.info("The state of ${showTasks} is ${status}")
- Thread.sleep(1000);
+ toCheckTaskRow = result[0]
+ status = toCheckTaskRow.get(1).toString()
+ if (lastLoggedStatus != status) {
+ logger.info("The state of ${showTasks} is ${status}, taskId is
${toCheckTaskRow.get(0)}")
+ lastLoggedStatus = status
+ }
+ if (status == 'PENDING' || status == 'RUNNING' || status ==
'NULL') {
+ Thread.sleep(500);
+ }
}
if (status != "SUCCESS") {
logger.info("status is not success")
}
Assert.assertEquals("SUCCESS", status)
- def show_tables = sql """
- show tables from ${toCheckTaskRow.get(6)};
- """
- def db_id = getDbId(toCheckTaskRow.get(6))
- def table_id = getTableId(toCheckTaskRow.get(6), mvName)
logger.info("waitingMTMVTaskFinished analyze mv name is " + mvName
- + ", db name is " + toCheckTaskRow.get(6)
- + ", show_tables are " + show_tables
- + ", db_id is " + db_id
- + ", table_id " + table_id)
- sql "analyze table ${toCheckTaskRow.get(6)}.${mvName} with sync;"
+ + ", db name is " + toCheckTaskRow.get(3)
+ + ", task id is " + toCheckTaskRow.get(0))
+ sql "analyze table ${toCheckTaskRow.get(3)}.${mvName} with sync;"
}
def waitingMTMVTaskFinishedByMvNameAllowCancel = {mvName, dbName =
context.dbName ->
+ // 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 MvDatabaseName = '${dbName}' and MvName = '${mvName}'
order by CreateTime ASC"
+ String showTasks = """
+ select TaskId, Status, MvName, MvDatabaseName, ErrorMsg from
tasks('type'='mv')
+ where MvDatabaseName = '${dbName}' and MvName = '${mvName}'
+ 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
- List<String> toCheckTaskRow = new ArrayList<>();
- while (timeoutTimestamp > System.currentTimeMillis() && (status ==
'PENDING' || status == 'RUNNING' || status == 'NULL' || status == 'CANCELED'))
{
+ long timeoutTimestamp = System.currentTimeMillis() + 5 * 60 * 1000 //
5 min
+ String lastLoggedStatus = null
+ List<Object> toCheckTaskRow = null
+ while (timeoutTimestamp > System.currentTimeMillis() && (status ==
'PENDING' || status == 'RUNNING' || status == 'NULL')) {
Review Comment:
In waitingMTMVTaskFinishedByMvNameAllowCancel, the old while condition
included status == 'CANCELED', meaning the loop would keep polling even after a
CANCELED state. The new code removes this, so CANCELED now exits the loop
immediately. Was this intentional?
--
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]