github-actions[bot] commented on code in PR #65453:
URL: https://github.com/apache/doris/pull/65453#discussion_r3567760446


##########
regression-test/plugins/plugin_index_change.groovy:
##########
@@ -51,25 +60,28 @@ Suite.metaClass.build_index_on_table = {index_name, 
table_name ->
 }
 
 Suite.metaClass.wait_for_last_col_change_finish = { table_name, OpTimeout ->
-    def useTime = 0
+    def finished = false
+    def alter_res = ""
 
-    for (int t = delta_time; t <= OpTimeout; t += delta_time) {
-        def alter_res = sql """SHOW ALTER TABLE COLUMN WHERE TableName = 
"${table_name}" ORDER BY CreateTime DESC LIMIT 1;"""
+    for (int t = 0; t <= OpTimeout; t += delta_time) {
+        alter_res = sql """SHOW ALTER TABLE COLUMN WHERE TableName = 
"${table_name}" ORDER BY CreateTime DESC LIMIT 1;"""
         alter_res = alter_res.toString()
         if (alter_res.contains("FINISHED")) {
             sleep(3000) // wait change table state to normal
             logger.info(table_name + " latest alter job finished, detail: " + 
alter_res)
+            finished = true
+            break
+        }
+        if (t >= OpTimeout) {
             break
         }
-        useTime = t
         sleep(delta_time)
     }
-    assertTrue(useTime <= OpTimeout, "wait_for_last_col_change_finish timeout")
+    assertTrue(finished, "wait_for_last_col_change_finish timeout, latest 
result: ${alter_res}")
 }
 
 Suite.metaClass.wait_for_last_schema_change_finish = {table_name, OpTimeout ->
     wait_for_last_col_change_finish(table_name, OpTimeout)
-    wait_for_last_build_index_finish(table_name, OpTimeout)

Review Comment:
   This wrapper is now column-only, but `test_add_drop_index.groovy` still 
calls `wait_for_last_schema_change_finish(indexTbName1, timeout)` immediately 
after `drop index name_idx` in the `enable_add_index_for_new_data=true` path. 
That drop is a full-table inverted-index drop, so FE treats it as a light index 
change and `modifyTableLightSchemaChange` enqueues asynchronous delete 
`IndexChangeJob`s through `buildOrDeleteTableInvertedIndices`. With the 
build-index wait removed here, the suite can proceed to the next `create index 
studentInfo_idx` while the drop job is still `WAITING_TXN`/`RUNNING`; the 
following schema change path rejects tables with active index-change jobs. 
Please update that caller too, e.g. wait the column job and then call 
`wait_for_last_build_index_finish(indexTbName1, timeout)` after the drop.



##########
regression-test/suites/variant_p0/with_index/load.groovy:
##########
@@ -58,7 +58,8 @@ suite("regression_test_variant_with_index", "p0"){
 
     build_index_on_table("inv_idx", table_name)
 
-    wait_for_last_schema_change_finish(table_name, timeout)
+    wait_for_last_col_change_finish(table_name, timeout)
+    wait_for_last_build_index_finish(table_name, timeout)

Review Comment:
   The drop path above still uses `wait_for_last_schema_change_finish`, but 
this PR changed that wrapper to wait only on `SHOW ALTER TABLE COLUMN`. For an 
inverted-index drop with `enable_add_index_for_new_data=true`, FE treats the 
full-table `DROP INDEX` as a light index change and 
`modifyTableLightSchemaChange` enqueues asynchronous delete `IndexChangeJob`s 
via `buildOrDeleteTableInvertedIndices`; those jobs are what 
`wait_for_last_build_index_finish` observes. After the line-52 drop wait, this 
suite can therefore move on to this create/build sequence while the drop job is 
still `WAITING_TXN`/`RUNNING`. In cloud mode the following build can also hit 
`hasIndexChangeJobOnPartition`, because any unfinished index-change job on the 
partition conflicts. Please split the earlier drop wait the same way: wait the 
column job and then call `wait_for_last_build_index_finish(table_name, 
timeout)` before creating `inv_idx`.



-- 
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]

Reply via email to