IMPALA-6560: fix regression test for IMPALA-2376 The test is modified to increase the size of collections allocated. num_nodes and mt_dop query options are set to make execution as deterministic as possible.
I looped the test overnight to try to flush out flakiness. Adds support for row_regex lines in CATCH sections so that we can match a larger part of the error message. Change-Id: I024cb6b57647902b1735defb885cd095fd99738c Reviewed-on: http://gerrit.cloudera.org:8080/9681 Reviewed-by: Tim Armstrong <[email protected]> Tested-by: Tim Armstrong <[email protected]> Reviewed-on: http://gerrit.cloudera.org:8080/10272 Project: http://git-wip-us.apache.org/repos/asf/impala/repo Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/385afe5f Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/385afe5f Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/385afe5f Branch: refs/heads/2.x Commit: 385afe5f45d2a89b2c246e9db20df74dd720e5d2 Parents: 82c43f4 Author: Tim Armstrong <[email protected]> Authored: Tue Mar 13 23:54:57 2018 -0700 Committer: Tim Armstrong <[email protected]> Committed: Thu May 3 15:28:03 2018 +0000 ---------------------------------------------------------------------- .../queries/QueryTest/nested-types-tpch.test | 21 ++++++++++++-------- tests/common/impala_test_suite.py | 13 +++++++++--- 2 files changed, 23 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/impala/blob/385afe5f/testdata/workloads/functional-query/queries/QueryTest/nested-types-tpch.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/functional-query/queries/QueryTest/nested-types-tpch.test b/testdata/workloads/functional-query/queries/QueryTest/nested-types-tpch.test index 6b213eb..a4c6c62 100644 --- a/testdata/workloads/functional-query/queries/QueryTest/nested-types-tpch.test +++ b/testdata/workloads/functional-query/queries/QueryTest/nested-types-tpch.test @@ -160,17 +160,22 @@ ORDER BY o_orderkey LIMIT 1 BIGINT,BIGINT ==== ---- QUERY -# IMPALA-2376 -# Set memory limit low enough to get the below query to consistently fail. -# This was originally a regression test that hit an error like: -# Failed to allocate buffer for collection '...'. -set mem_limit=4m; -select max(cnt) from customer c, -(select count(l_returnflag) cnt from c.c_orders.o_lineitems) v; +# IMPALA-2376: run scan that constructs large collection and set memory limit low enough +# to get the below query to consistently fail when allocating a large collection. Set +# num_nodes and mt_dop to 1 in order to make the query as deterministic as possible. +set buffer_pool_limit=40m; +set mem_limit=50m; +set num_nodes=1; +set mt_dop=1; +select max(cnt1), max(cnt2), max(cnt3), max(cnt4), max(cnt5) +from customer c, + (select count(l_returnflag) cnt1, count(l_partkey) cnt2, count(l_suppkey) cnt3, + count(l_linenumber) cnt4, count(l_quantity) cnt5 + from c.c_orders.o_lineitems) v; ---- TYPES BIGINT ---- CATCH -Rejected query from pool default-pool: minimum memory reservation is greater than memory available to the query for buffer reservations. +row_regex: .*Memory limit exceeded: Failed to allocate [0-9]+ bytes for collection 'tpch_nested_parquet.customer.c_orders.item.o_lineitems'.* ==== ---- QUERY # IMPALA-2473: Scan query with large row size leading to oversized batches. http://git-wip-us.apache.org/repos/asf/impala/blob/385afe5f/tests/common/impala_test_suite.py ---------------------------------------------------------------------- diff --git a/tests/common/impala_test_suite.py b/tests/common/impala_test_suite.py index 9dcb0ca..0babfb3 100644 --- a/tests/common/impala_test_suite.py +++ b/tests/common/impala_test_suite.py @@ -47,6 +47,7 @@ from tests.common.test_dimensions import ( load_table_info_dimension) from tests.common.test_result_verifier import ( apply_error_match_filter, + try_compile_regex, verify_raw_results, verify_runtime_profile) from tests.common.test_vector import ImpalaTestDimension @@ -260,8 +261,9 @@ class ImpalaTestSuite(BaseTestSuite): def __verify_exceptions(self, expected_strs, actual_str, use_db): """ - Verifies that at least one of the strings in 'expected_str' is a substring of the - actual exception string 'actual_str'. + Verifies that at least one of the strings in 'expected_str' is either: + * A row_regex: line that matches the actual exception string 'actual_str' + * A substring of the actual exception string 'actual_str'. """ actual_str = actual_str.replace('\n', '') for expected_str in expected_strs: @@ -274,7 +276,12 @@ class ImpalaTestSuite(BaseTestSuite): if use_db: expected_str = expected_str.replace('$DATABASE', use_db) # Strip newlines so we can split error message into multiple lines expected_str = expected_str.replace('\n', '') - if expected_str in actual_str: return + expected_regex = try_compile_regex(expected_str) + if expected_regex: + if expected_regex.match(actual_str): return + else: + # Not a regex - check if expected substring is present in actual. + if expected_str in actual_str: return assert False, 'Unexpected exception string. Expected: %s\nNot found in actual: %s' % \ (expected_str, actual_str)
