This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 74908c123a5 [fix](test)Fix unstable test drop index fault #38768 
(#38772)
74908c123a5 is described below

commit 74908c123a53d1bf946177c515244cdb01b9bbba
Author: qiye <jianliang5...@gmail.com>
AuthorDate: Sat Aug 3 23:47:55 2024 +0800

    [fix](test)Fix unstable test drop index fault #38768 (#38772)
    
    ## Proposed changes
    
    bp #38768
    
    <!--Describe your changes.-->
---
 ...index_builder_drop_index_fault_injection.groovy | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git 
a/regression-test/suites/fault_injection_p0/test_index_builder_drop_index_fault_injection.groovy
 
b/regression-test/suites/fault_injection_p0/test_index_builder_drop_index_fault_injection.groovy
index f8501f0e851..353afdf0769 100644
--- 
a/regression-test/suites/fault_injection_p0/test_index_builder_drop_index_fault_injection.groovy
+++ 
b/regression-test/suites/fault_injection_p0/test_index_builder_drop_index_fault_injection.groovy
@@ -18,6 +18,24 @@
 import org.codehaus.groovy.runtime.IOGroovyMethods
 
 suite("test_index_builder_drop_index_fault_injection", "nonConcurrent") {
+    def timeout = 60000
+    def delta_time = 1000
+    def alter_res = "null"
+    def useTime = 0
+    def wait_for_latest_op_on_table_finish = { table_name, OpTimeout ->
+        for(int t = delta_time; 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)
+                break
+            }
+            useTime = t
+            sleep(delta_time)
+        }
+        assertTrue(useTime <= OpTimeout, "wait_for_latest_op_on_table_finish 
timeout")
+    }
     def runTest = { indexTbName ->
         sql """ insert into ${indexTbName} values(1, "json love anny", "json", 
"anny",1); """
         sql "sync"
@@ -33,6 +51,7 @@ suite("test_index_builder_drop_index_fault_injection", 
"nonConcurrent") {
         try {
             
GetDebugPoint().enableDebugPointForAllBEs("index_builder.update_inverted_index_info.drop_index",
 [indexes_count: 3])
             sql "DROP INDEX index_int ON ${indexTbName}"
+            wait_for_latest_op_on_table_finish(indexTbName, timeout)
             show_result = sql_return_maparray "show index from ${indexTbName}"
             logger.info("show index from " + indexTbName + " result: " + 
show_result)
             assertEquals(show_result.size(), 3)
@@ -46,6 +65,7 @@ suite("test_index_builder_drop_index_fault_injection", 
"nonConcurrent") {
         try {
             
GetDebugPoint().enableDebugPointForAllBEs("index_builder.update_inverted_index_info.drop_index",
 [indexes_count: 2])
             sql "DROP INDEX index_str_k2 ON ${indexTbName}"
+            wait_for_latest_op_on_table_finish(indexTbName, timeout)
             show_result = sql_return_maparray "show index from ${indexTbName}"
             logger.info("show index from " + indexTbName + " result: " + 
show_result)
             assertEquals(show_result.size(), 2)
@@ -58,6 +78,7 @@ suite("test_index_builder_drop_index_fault_injection", 
"nonConcurrent") {
         try {
             
GetDebugPoint().enableDebugPointForAllBEs("index_builder.update_inverted_index_info.drop_index",
 [indexes_count: 1])
             sql "DROP INDEX index_str_k4 ON ${indexTbName}"
+            wait_for_latest_op_on_table_finish(indexTbName, timeout)
             show_result = sql_return_maparray "show index from ${indexTbName}"
             logger.info("show index from " + indexTbName + " result: " + 
show_result)
             assertEquals(show_result.size(), 1)
@@ -69,6 +90,7 @@ suite("test_index_builder_drop_index_fault_injection", 
"nonConcurrent") {
         try {
             
GetDebugPoint().enableDebugPointForAllBEs("index_builder.update_inverted_index_info.drop_index",
 [indexes_count: 0])
             sql "DROP INDEX index_k5 ON ${indexTbName}"
+            wait_for_latest_op_on_table_finish(indexTbName, timeout)
             show_result = sql_return_maparray "show index from ${indexTbName}"
             logger.info("show index from " + indexTbName + " result: " + 
show_result)
             assertEquals(show_result.size(), 0)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to