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

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

commit 52403541f2e11b6eeaaac849b2a3c739e80a6c2d
Author: Arnab Karmakar <[email protected]>
AuthorDate: Fri Jan 2 12:32:45 2026 +0530

    IMPALA-14651: Fix flaky test_loaded_tables_metric due to report delay
    
    test_loaded_tables_metric() added in IMPALA-13863 was failing
    intermittently because it didn't account for the random delay in
    ImpaladTableUsageTracker's table usage reporting.
    The tracker sleeps for [0.5, 1.5) * REPORT_INTERVAL_MS (5-15s) before
    sending usage reports to catalogd, after which the TTL countdown
    begins.
    
    The test was waiting for timeout * 2, but the actual max time is:
    - Invalidation TTL: timeout
    - Report delay: up to 15s (1.5 * 10s REPORT_INTERVAL_MS)
    - Metric update + RPC/serde buffer: ~2s
    
    Changed the wait timeout from (timeout * 2) to (timeout + 17) to properly
    account for the maximum report delay plus TTL and metric update.
    
    Change-Id: I7a0a1df5a398a0c0d74c561a0a4b4a0defbac7a7
    Reviewed-on: http://gerrit.cloudera.org:8080/23822
    Reviewed-by: Impala Public Jenkins <[email protected]>
    Tested-by: Impala Public Jenkins <[email protected]>
---
 tests/custom_cluster/test_automatic_invalidation.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/custom_cluster/test_automatic_invalidation.py 
b/tests/custom_cluster/test_automatic_invalidation.py
index 2203b7578..e887a2770 100644
--- a/tests/custom_cluster/test_automatic_invalidation.py
+++ b/tests/custom_cluster/test_automatic_invalidation.py
@@ -201,9 +201,12 @@ class 
TestAutomaticCatalogInvalidation(CustomClusterTestSuite):
     catalogd.wait_for_metric_value(metric_name, 1)
     assert self.metadata_cache_string in self._get_catalog_object()
 
-    # Wait for automatic timeout-based invalidation to complete and metric to 
update
-    # Timeout is 2x the invalidation timeout to account for background 
processing delays
-    catalogd.wait_for_metric_value(metric_name, 0, timeout=self.timeout * 2)
+    # Wait for automatic timeout-based invalidation to complete and metric to 
update.
+    # ImpaladTableUsageTracker reports table usage with a delay of up to 15 
seconds
+    # (1.5 * REPORT_INTERVAL_MS where REPORT_INTERVAL_MS=10s), then the 
invalidation
+    # TTL kicks in. Add ~1s extra for metric updates and ~1s buffer for RPC, 
serde, etc.
+    # Max time = 15s (max report delay) + self.timeout (TTL) + 2s
+    catalogd.wait_for_metric_value(metric_name, 0, timeout=self.timeout + 17)
     # Verify that the table metadata was actually invalidated
     assert self.metadata_cache_string not in self._get_catalog_object(), \
         "Table metadata should be invalidated after timeout"

Reply via email to