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

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


The following commit(s) were added to refs/heads/master by this push:
     new 712a37bce IMPALA-12997: Use graceful shutdown for query log tests
712a37bce is described below

commit 712a37bce461c233bc9e648550e82696bef0f224
Author: Michael Smith <[email protected]>
AuthorDate: Mon Apr 22 16:05:09 2024 -0700

    IMPALA-12997: Use graceful shutdown for query log tests
    
    Uses graceful shutdown for all tests that might insert into
    'sys.impala_query_log' to avoid leaving the table locked in HMS by a
    SIGTERM. That's primarily any test that lowers
    'query_log_write_interval_s' or 'query_log_max_queued'.
    
    Lowers grace period on test_query_log_table_flush_on_shutdown because
    ShutdownWorkloadManagement() is not started until the grace period ends.
    
    Updates "Adding/Removing local backend" to only apply to executors. It
    was only added for executors, but would be removed on dedicated
    coordinators as well (resulting in a DFATAL message during graceful
    shutdown).
    
    Change-Id: Ia123c53a952a77ff4a9c02736b5717ccaa3566dc
    Reviewed-on: http://gerrit.cloudera.org:8080/21345
    Reviewed-by: Impala Public Jenkins <[email protected]>
    Tested-by: Impala Public Jenkins <[email protected]>
---
 be/src/scheduling/cluster-membership-mgr.cc | 20 ++++++++++++--------
 tests/custom_cluster/test_query_live.py     |  3 +++
 tests/custom_cluster/test_query_log.py      | 12 ++++++------
 3 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/be/src/scheduling/cluster-membership-mgr.cc 
b/be/src/scheduling/cluster-membership-mgr.cc
index a296b2f35..d01787752 100644
--- a/be/src/scheduling/cluster-membership-mgr.cc
+++ b/be/src/scheduling/cluster-membership-mgr.cc
@@ -393,14 +393,18 @@ void ClusterMembershipMgr::UpdateMembership(
   if (NeedsLocalBackendUpdate(*new_state, local_be_desc)) {
     // We need to update both the new membership state and the statestore
     (*new_backend_map)[local_backend_id_] = *local_be_desc;
-    for (const auto& group : local_be_desc->executor_groups()) {
-      if (local_be_desc->is_quiescing()) {
-        VLOG(1) << "Removing local backend from group " << group.DebugString();
-        RemoveExecutorAndGroup(*local_be_desc, group, new_executor_groups);
-      } else if (local_be_desc->is_executor()) {
-        VLOG(1) << "Adding local backend to group " << group.DebugString();
-        FindOrInsertExecutorGroup(
-            group, new_executor_groups)->AddExecutor(*local_be_desc);
+    // Could be a coordinator and/or executor, but only executors add the 
local backend.
+    DCHECK(local_be_desc->is_coordinator() || local_be_desc->is_executor());
+    if (local_be_desc->is_executor()) {
+      for (const auto& group : local_be_desc->executor_groups()) {
+        if (local_be_desc->is_quiescing()) {
+          VLOG(1) << "Removing local backend from group " << 
group.DebugString();
+          RemoveExecutorAndGroup(*local_be_desc, group, new_executor_groups);
+        } else {
+          VLOG(1) << "Adding local backend to group " << group.DebugString();
+          FindOrInsertExecutorGroup(
+              group, new_executor_groups)->AddExecutor(*local_be_desc);
+        }
       }
     }
     AddLocalBackendToStatestore(*local_be_desc, subscriber_topic_updates);
diff --git a/tests/custom_cluster/test_query_live.py 
b/tests/custom_cluster/test_query_live.py
index 9629afb5d..25444d075 100644
--- a/tests/custom_cluster/test_query_live.py
+++ b/tests/custom_cluster/test_query_live.py
@@ -339,8 +339,11 @@ class TestQueryLive(CustomClusterTestSuite):
 
   @CustomClusterTestSuite.with_args(impalad_args="--enable_workload_mgmt "
                                                  
"--query_log_write_interval_s=1 "
+                                                 "--shutdown_grace_period_s=10 
"
+                                                 "--shutdown_deadline_s=60 "
                                                  
"--cluster_id=test_query_live",
                                     catalogd_args="--enable_workload_mgmt",
+                                    impalad_graceful_shutdown=True,
                                     cluster_size=3,
                                     num_exclusive_coordinators=2)
   def test_multi_table_union(self):
diff --git a/tests/custom_cluster/test_query_log.py 
b/tests/custom_cluster/test_query_log.py
index a81f92ca5..a5c1f87a2 100644
--- a/tests/custom_cluster/test_query_log.py
+++ b/tests/custom_cluster/test_query_log.py
@@ -407,7 +407,7 @@ class TestQueryLogTableBeeswax(TestQueryLogTableBase):
                                     cluster_size=3,
                                     num_exclusive_coordinators=2,
                                     catalogd_args="--enable_workload_mgmt",
-                                    impalad_graceful_shutdown=False)
+                                    impalad_graceful_shutdown=True)
   def test_query_log_table_query_select_dedicate_coordinator(self, vector):
     """Asserts the values written to the query log table match the values from 
the
        query profile when dedicated coordinators are used."""
@@ -436,7 +436,7 @@ class TestQueryLogTableBeeswax(TestQueryLogTableBase):
                                     cluster_size=3,
                                     num_exclusive_coordinators=2,
                                     catalogd_args="--enable_workload_mgmt",
-                                    impalad_graceful_shutdown=False)
+                                    impalad_graceful_shutdown=True)
   def test_query_log_table_query_select_mt_dop(self, vector):
     """Asserts the values written to the query log table match the values from 
the
        query profile when dedicated coordinators are used along with an MT_DOP 
setting
@@ -694,13 +694,13 @@ class TestQueryLogTableHS2(TestQueryLogTableBase):
 
   @CustomClusterTestSuite.with_args(impalad_args="--enable_workload_mgmt "
                                                  
"--query_log_write_interval_s=9999 "
-                                                 "--shutdown_grace_period_s=30 
"
+                                                 "--shutdown_grace_period_s=1 "
                                                  "--shutdown_deadline_s=30",
-                                    catalogd_args="--enable_workload_mgmt",
-                                    impalad_graceful_shutdown=False)
+                                    catalogd_args="--enable_workload_mgmt")
   def test_query_log_table_flush_on_shutdown(self, vector):
     """Asserts that queries that have completed but are not yet written to the 
query
-       log table are flushed to the table before the coordinator exits."""
+       log table are flushed to the table before the coordinator exits. 
Graceful shutdown
+       for 2nd coordinator not needed because query_log_write_interval_s is 
very long."""
 
     impalad = self.cluster.get_first_impalad()
     client = self.get_client(vector.get_value('protocol'))

Reply via email to