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

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

commit fef3564248208fca2e420df98b96dd5b5335894f
Author: Riza Suminto <[email protected]>
AuthorDate: Tue Oct 31 15:21:27 2023 -0700

    IMPALA-12532: Fix bug in cancel_query_and_validate_state
    
    test_cancellation.py was silently buggy for not exercising exec_option
    combinations configured at TestCancellation::execute_cancel_test().
    
    change_database() should not be called right after set_configuration()
    in cancel_util.py::cancel_query_and_validate_state(). This is because
    change_database() will erase all configuration that was previously set.
    
    This patch fix the issue by calling change_database() first before
    set_configuration(). Similar pattern also fixed in
    test_admission_controller.py.
    
    Testing:
    - Manually run test_cancellation.py and confirm at coordinator log that
      query options are set properly.
    
    Change-Id: Ie908fc1384279482892c3f8b2cfa3592e54f9d5a
    Reviewed-on: http://gerrit.cloudera.org:8080/20641
    Reviewed-by: Impala Public Jenkins <[email protected]>
    Tested-by: Impala Public Jenkins <[email protected]>
---
 tests/custom_cluster/test_admission_controller.py | 10 +++++-----
 tests/util/cancel_util.py                         |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/custom_cluster/test_admission_controller.py 
b/tests/custom_cluster/test_admission_controller.py
index 43199fc00..174f263f3 100644
--- a/tests/custom_cluster/test_admission_controller.py
+++ b/tests/custom_cluster/test_admission_controller.py
@@ -575,8 +575,8 @@ class TestAdmissionController(TestAdmissionControllerBase, 
HS2TestSuite):
   def test_sanity_checks_dedicated_coordinator(self, vector, unique_database):
     """Sanity tests for verifying targeted dedicated coordinator memory 
estimations and
     behavior."""
-    self.client.set_configuration_option('request_pool', "root.regularPool")
     ImpalaTestSuite.change_database(self.client, 
vector.get_value('table_format'))
+    self.client.set_configuration_option('request_pool', "root.regularPool")
     exec_options = vector.get_value('exec_option')
     # Make sure query option MAX_MEM_ESTIMATE_FOR_ADMISSION is enforced on the 
dedicated
     # coord estimates. Without this query option the estimate would be > 100MB.
@@ -621,8 +621,8 @@ class TestAdmissionController(TestAdmissionControllerBase, 
HS2TestSuite):
     the actual vs expected values for mem admitted and mem limit for both 
coord and
     executor. Also verifies that those memory values are different if
     'using_dedicated_coord_estimates' is true."""
-    self.client.set_configuration_option('request_pool', "root.regularPool")
     ImpalaTestSuite.change_database(self.client, 
vector.get_value('table_format'))
+    self.client.set_configuration_option('request_pool', "root.regularPool")
     # Use a test query that has unpartitioned non-coordinator fragments to make
     # sure those are handled correctly (IMPALA-10036).
     for query in [QUERY, QUERY_WITH_UNPARTITIONED_FRAGMENTS]:
@@ -706,8 +706,8 @@ class TestAdmissionController(TestAdmissionControllerBase, 
HS2TestSuite):
   def test_mem_limit_executors(self, vector, unique_database):
     """Verify that the query option mem_limit_executors is only enforced on the
     executors."""
-    expected_exec_mem_limit = "999999999"
     ImpalaTestSuite.change_database(self.client, 
vector.get_value('table_format'))
+    expected_exec_mem_limit = "999999999"
     self.client.set_configuration({"MEM_LIMIT_EXECUTORS": 
expected_exec_mem_limit})
     handle = self.client.execute_async(QUERY.format(1))
     self.client.wait_for_finished_timeout(handle, 1000)
@@ -725,9 +725,9 @@ class TestAdmissionController(TestAdmissionControllerBase, 
HS2TestSuite):
   def test_mem_limit_coordinators(self, vector, unique_database):
     """Verify that the query option mem_limit_coordinators is only enforced on 
the
     coordinators."""
+    ImpalaTestSuite.change_database(self.client, 
vector.get_value('table_format'))
     expected_exec_mem_limit = "999999999"
     expected_coord_mem_limit = "111111111"
-    ImpalaTestSuite.change_database(self.client, 
vector.get_value('table_format'))
     self.client.set_configuration({"MEM_LIMIT_EXECUTORS": 
expected_exec_mem_limit,
         "MEM_LIMIT_COORDINATORS": expected_coord_mem_limit})
     handle = self.client.execute_async(QUERY.format(1))
@@ -746,10 +746,10 @@ class 
TestAdmissionController(TestAdmissionControllerBase, HS2TestSuite):
   def test_mem_limits(self, vector, unique_database):
     """Verify that the query option mem_limit_coordinators and 
mem_limit_executors are
     ignored when mem_limit is set."""
+    ImpalaTestSuite.change_database(self.client, 
vector.get_value('table_format'))
     exec_mem_limit = "999999999"
     coord_mem_limit = "111111111"
     mem_limit = "888888888"
-    ImpalaTestSuite.change_database(self.client, 
vector.get_value('table_format'))
     self.client.set_configuration({"MEM_LIMIT_EXECUTORS": exec_mem_limit,
         "MEM_LIMIT_COORDINATORS": coord_mem_limit, "MEM_LIMIT": mem_limit})
     handle = self.client.execute_async(QUERY.format(1))
diff --git a/tests/util/cancel_util.py b/tests/util/cancel_util.py
index 60dabc4c5..d2f011824 100644
--- a/tests/util/cancel_util.py
+++ b/tests/util/cancel_util.py
@@ -31,8 +31,8 @@ def cancel_query_and_validate_state(client, query, 
exec_option, table_format,
   calls to ImpalaConnection#fetch and #close are consistent. If 
'join_before_close' is
   True the method will join against the fetch results thread before closing 
the query.
   """
-  if exec_option: client.set_configuration(exec_option)
   if table_format: ImpalaTestSuite.change_database(client, table_format)
+  if exec_option: client.set_configuration(exec_option)
   handle = client.execute_async(query)
 
   thread = threading.Thread(target=__fetch_results, args=(query, handle))

Reply via email to