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 3725b4ea63b32724b1a6904fdb4d11d4d6e9bdc6
Author: stiga-huang <[email protected]>
AuthorDate: Wed Dec 17 17:02:44 2025 +0800

    IMPALA-14617: Deflake TestMetadataReplicas.test_catalog_restart
    
    TestMetadataReplicas.test_catalog_restart creates a db and an underlying
    table in Hive, then expects an INVALIDATE command can bring up the table
    in impalads. The test runs in the legacy catalogd mode that has the bug
    of IMPALA-12103. So if the INVALIDATE command runs in a state that
    catalgod has the db in cache but the db doesn't show up in impalad's
    cache yet, catalogd will just return the table and impalad will skip it
    due to db not exists. Then the above assertion fails.
    
    The db is added in catalogd cache by processing the CREATE_DATABASE HMS
    event, which is asynchronous with executing the INVALIDATE command. If
    the command is triggered before that, the test passes. If the command is
    triggered after that, the test fails.
    
    When the test was written, we don't have HMS event processing yet. It's
    expected that the db is also added in catalogd by the INVALIDATE
    command. To deflake the issue, this patch disables HMS event processing
    in this test, so catalogd always has a consistent cache with impalad
    when executing the INVALIDATE command.
    
    This patch also changes the log level of a log in ImpaladCatalog to warn
    if a table is not added due to its db is missing.
    
    Tests:
     - Ran the test locally 10 times.
    
    Change-Id: I2d17404cc8093eacf9b51df3d22caf5cbb6a61a9
    Reviewed-on: http://gerrit.cloudera.org:8080/23798
    Reviewed-by: Impala Public Jenkins <[email protected]>
    Tested-by: Impala Public Jenkins <[email protected]>
---
 fe/src/main/java/org/apache/impala/catalog/ImpaladCatalog.java | 6 ++----
 tests/custom_cluster/test_metadata_replicas.py                 | 7 +++++--
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/fe/src/main/java/org/apache/impala/catalog/ImpaladCatalog.java 
b/fe/src/main/java/org/apache/impala/catalog/ImpaladCatalog.java
index af834430c..d5f8cd34b 100644
--- a/fe/src/main/java/org/apache/impala/catalog/ImpaladCatalog.java
+++ b/fe/src/main/java/org/apache/impala/catalog/ImpaladCatalog.java
@@ -473,10 +473,8 @@ public class ImpaladCatalog extends Catalog implements 
FeCatalog {
       long catalogVersion, long lastLoadedTime) throws TableLoadingException {
     Db db = getDb(thriftTable.db_name);
     if (db == null) {
-      if (LOG.isTraceEnabled()) {
-        LOG.trace("Parent database of table does not exist: " +
-            thriftTable.db_name + "." + thriftTable.tbl_name);
-      }
+      LOG.warn("Not adding table since the database does not exist: " +
+          thriftTable.db_name + "." + thriftTable.tbl_name);
       return;
     }
 
diff --git a/tests/custom_cluster/test_metadata_replicas.py 
b/tests/custom_cluster/test_metadata_replicas.py
index 2a1dd3dfb..2480a6a44 100644
--- a/tests/custom_cluster/test_metadata_replicas.py
+++ b/tests/custom_cluster/test_metadata_replicas.py
@@ -26,11 +26,14 @@ from tests.util.hive_utils import HiveDbWrapper
 @SkipIfFS.hive
 @CustomClusterTestSuite.with_args(
     impalad_args="--use_local_catalog=false",
-    catalogd_args="--catalog_topic_mode=full",
+    catalogd_args="--catalog_topic_mode=full --hms_event_polling_interval_s=0",
     statestored_args="--statestore_update_frequency_ms=1000")
 class TestMetadataReplicas(CustomClusterTestSuite):
   """ Validates metadata content across catalogd and impalad coordinators.
-  This test is only valid in legacy catalog mode. """
+  This test is only valid in legacy catalog mode. Disables HMS event 
processing to avoid
+  catalogd cache being modified unintentionally by HMS events. The test 
expects the
+  INVALIDATE command to bring up the latest metadata from HMS. This avoids 
hitting the bug
+  of IMPALA-12103. """
 
   @classmethod
   def setup_class(cls):

Reply via email to