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

boroknagyz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit 2040f665692f75685e2fe62cc3a608451aac4ffb
Author: Riza Suminto <[email protected]>
AuthorDate: Sat May 10 18:59:02 2025 -0700

    IMPALA-14042: Deflake TestConcurrentRename.test_rename_drop
    
    TestConcurrentRename.test_rename_drop has been flaky because the
    INVALIDATE query may arrive ahead of the ALTER TABLE RENAME query. This
    patch deflake it by changing the sleep with admission control wait and
    catalog version check. The first INVALIDATE query will only start after
    catalog version increase since CREATE TABLE query.
    
    Testing:
    Loop the test 50x and pass them all.
    
    Change-Id: I2539d5755aae6d375400b9a1289a658d0e7ba888
    Reviewed-on: http://gerrit.cloudera.org:8080/22876
    Reviewed-by: Yida Wu <[email protected]>
    Reviewed-by: Jason Fehr <[email protected]>
    Tested-by: Riza Suminto <[email protected]>
---
 tests/custom_cluster/test_concurrent_rename.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tests/custom_cluster/test_concurrent_rename.py 
b/tests/custom_cluster/test_concurrent_rename.py
index e2dfb58ea..100be5bd3 100644
--- a/tests/custom_cluster/test_concurrent_rename.py
+++ b/tests/custom_cluster/test_concurrent_rename.py
@@ -32,6 +32,7 @@ class TestConcurrentRename(CustomClusterTestSuite):
   """Test concurrent rename with invalidate and other DDLs."""
 
   def test_rename_drop(self, vector, unique_database):
+    catalogd = self.cluster.catalogd
     name = "{}.tbl".format(unique_database)
     self.execute_query("create table {} (s string)".format(name))
     self.execute_query("describe {}".format(name))
@@ -41,9 +42,16 @@ class TestConcurrentRename(CustomClusterTestSuite):
         "catalogd_table_rename_delay:SLEEP@5000"
     with self.create_impala_client_from_vector(new_vector) as alter_client, \
          self.create_impala_client() as reset_client:
+      version_after_create = catalogd.service.get_catalog_version()
       alter_handle = alter_client.execute_async(
         "alter table {0} rename to {0}2".format(name))
-      time.sleep(0.1)
+      alter_client.wait_for_admission_control(alter_handle, timeout_s=10)
+      # Wait for at most 10 second until catalogd increase the version for 
rename
+      # operation.
+      start_time = time.time()
+      while (time.time() - start_time < 10.0
+             and catalogd.service.get_catalog_version() <= 
version_after_create):
+        time.sleep(0.05)
       reset_handle = reset_client.execute_async("invalidate metadata 
{}".format(name))
       self.execute_query("invalidate metadata {}2".format(name))
       self.execute_query("drop table {}2".format(name))

Reply via email to