IMPALA-4388: Fix query option reset in tests Before this change, using sync_ddl=1 could prevent query options from being reset correctly. The test execution would use a connection to a random impalad and execute the test against it, but then undo all changes to the query options on the default connection (instead of the one used for the test).
The fix is to undo the changes on the correct connection. Change-Id: I82e97438ee9f4f75907704653faa884722213f5d Reviewed-on: http://gerrit.cloudera.org:8080/4870 Reviewed-by: Tim Armstrong <[email protected]> Tested-by: Internal Jenkins Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/2808b84a Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/2808b84a Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/2808b84a Branch: refs/heads/master Commit: 2808b84ad72ea58cd29d06b4b6d18f5061c93474 Parents: f7d7195 Author: Lars Volker <[email protected]> Authored: Thu Oct 27 13:18:34 2016 -0700 Committer: Internal Jenkins <[email protected]> Committed: Fri Oct 28 01:26:26 2016 +0000 ---------------------------------------------------------------------- tests/common/impala_test_suite.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/2808b84a/tests/common/impala_test_suite.py ---------------------------------------------------------------------- diff --git a/tests/common/impala_test_suite.py b/tests/common/impala_test_suite.py index df88148..46b7eee 100644 --- a/tests/common/impala_test_suite.py +++ b/tests/common/impala_test_suite.py @@ -169,14 +169,14 @@ class ImpalaTestSuite(BaseTestSuite): self.client.set_configuration({'sync_ddl': sync_ddl}) self.client.execute("drop database if exists `" + db_name + "` cascade") - def __restore_query_options(self, query_options_changed): + def __restore_query_options(self, query_options_changed, impalad_client): """ Restore the list of modified query options to their default values. """ # Populate the default query option if it's empty. if not self.default_query_options: try: - query_options = self.client.get_default_configuration() + query_options = impalad_client.get_default_configuration() for query_option in query_options: self.default_query_options[query_option.key.upper()] = query_option.value except Exception as e: @@ -190,7 +190,7 @@ class ImpalaTestSuite(BaseTestSuite): default_val = self.default_query_options[query_option] query_str = 'SET '+ query_option + '=' + default_val + ';' try: - self.client.execute(query_str) + impalad_client.execute(query_str) except Exception as e: LOG.info('Unexpected exception when executing ' + query_str + ' : ' + str(e)) @@ -325,7 +325,7 @@ class ImpalaTestSuite(BaseTestSuite): raise finally: if len(query_options_changed) > 0: - self.__restore_query_options(query_options_changed) + self.__restore_query_options(query_options_changed, target_impalad_client) if 'CATCH' in test_section: assert test_section['CATCH'].strip() == ''
