mirror of
https://github.com/apache/impala.git
synced 2025-12-19 18:12:08 -05:00
This change adds get_workload() to ImpalaTestSuite and removes it from all test suites that already returned 'functional-query'. get_workload() is also removed from CustomClusterTestSuite which used to return 'tpch'. All other changes besides impala_test_suite.py and custom_cluster_test_suite.py are just mass removals of get_workload() functions. The behavior is only changed in custom cluster tests that didn't override get_workload(). By returning 'functional-query' instead of 'tpch', exploration_strategy() will no longer return 'core' in 'exhaustive' test runs. See IMPALA-3947 on why workload affected exploration_strategy. An example for affected test is TestCatalogHMSFailures which was skipped both in core and exhaustive runs before this change. get_workload() functions that return a different workload than 'functional-query' are not changed - it is possible that some of these also don't handle exploration_strategy() as expected, but individually checking these tests is out of scope in this patch. Change-Id: I9ec6c41ffb3a30e1ea2de773626d1485c69fe115 Reviewed-on: http://gerrit.cloudera.org:8080/22726 Reviewed-by: Riza Suminto <riza.suminto@cloudera.com> Reviewed-by: Daniel Becker <daniel.becker@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
127 lines
6.2 KiB
Python
127 lines
6.2 KiB
Python
# Licensed to the Apache Software Foundation (ASF) under one
|
|
# or more contributor license agreements. See the NOTICE file
|
|
# distributed with this work for additional information
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
# to you under the Apache License, Version 2.0 (the
|
|
# "License"); you may not use this file except in compliance
|
|
# with the License. You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing,
|
|
# software distributed under the License is distributed on an
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
# KIND, either express or implied. See the License for the
|
|
# specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
from __future__ import absolute_import, division, print_function
|
|
import pytest
|
|
|
|
from tests.common.custom_cluster_test_suite import CustomClusterTestSuite
|
|
from tests.common.skip import SkipIfBuildType
|
|
|
|
|
|
@SkipIfBuildType.not_dev_build
|
|
class TestCatalogWait(CustomClusterTestSuite):
|
|
"""Impalad coordinators must wait for their local replica of the catalog to be
|
|
initialized from the statestore prior to opening up client ports.
|
|
This test simulates a failed or slow catalog on impalad startup."""
|
|
|
|
def expect_connection(self, impalad):
|
|
impalad.service.create_hs2_client()
|
|
|
|
def expect_no_connection(self, impalad):
|
|
with pytest.raises(Exception) as e:
|
|
impalad.service.create_hs2_client()
|
|
assert 'Could not connect to' in str(e.value)
|
|
|
|
@pytest.mark.execute_serially
|
|
def test_delayed_impalad_catalog(self):
|
|
""" Tests client interactions with the cluster when one of the daemons,
|
|
impalad[2], is delayed in initializing its local catalog replica.
|
|
This delay is simulated on the impalad side, and the catalogd starts
|
|
up normally."""
|
|
|
|
# On startup, expect only two executors to be registered.
|
|
self._start_impala_cluster(["--catalog_init_delays=0,0,200000"],
|
|
expected_num_impalads=2,
|
|
expected_subscribers=4)
|
|
|
|
# Expect that impalad[2] is not ready.
|
|
self.cluster.impalads[2].service.wait_for_metric_value('impala-server.ready', 0);
|
|
|
|
# Expect that impalad[0,1] are both ready and with initialized catalog.
|
|
self.cluster.impalads[0].service.wait_for_metric_value('impala-server.ready', 1);
|
|
self.cluster.impalads[0].service.wait_for_metric_value('catalog.ready', 1);
|
|
self.cluster.impalads[1].service.wait_for_metric_value('impala-server.ready', 1);
|
|
self.cluster.impalads[1].service.wait_for_metric_value('catalog.ready', 1);
|
|
|
|
# Expect that connections can be made to impalads[0,1], but not to impalads[2].
|
|
self.expect_connection(self.cluster.impalads[0])
|
|
self.expect_connection(self.cluster.impalads[1])
|
|
self.expect_no_connection(self.cluster.impalads[2])
|
|
|
|
# Issues a query to check that impalad[2] does not evaluate any fragments
|
|
# and does not prematurely register itself as an executor. The former is
|
|
# verified via query fragment metrics and the latter would fail if registered
|
|
# but unable to process fragments.
|
|
client0 = self.cluster.impalads[0].service.create_hs2_client()
|
|
client1 = self.cluster.impalads[1].service.create_hs2_client()
|
|
|
|
self.execute_query_expect_success(client0, "select * from functional.alltypes");
|
|
self.execute_query_expect_success(client1, "select * from functional.alltypes");
|
|
|
|
# Check that fragments were run on impalad[0,1] and none on impalad[2].
|
|
# Each ready impalad runs a fragment per query and one coordinator fragment. With
|
|
# two queries, one coordinated per ready impalad, that should be 3 total fragments.
|
|
self.cluster.impalads[0].service.wait_for_metric_value('impala-server.num-fragments', 3);
|
|
self.cluster.impalads[1].service.wait_for_metric_value('impala-server.num-fragments', 3);
|
|
self.cluster.impalads[2].service.wait_for_metric_value('impala-server.num-fragments', 0);
|
|
|
|
|
|
@SkipIfBuildType.not_dev_build
|
|
class TestCatalogStartupDelay(CustomClusterTestSuite):
|
|
"""This test injects a real delay in catalogd startup. The impalads are expected to be
|
|
able to tolerate this delay, either because they wait (as coordinators do) or
|
|
because they don't need anything from the catalogd. This is done for a few
|
|
different cluster setups (different metadata, exclusive coordinators). This
|
|
is not testing anything beyond successful startup."""
|
|
|
|
@classmethod
|
|
def setup_class(cls):
|
|
if cls.exploration_strategy() != 'exhaustive':
|
|
pytest.skip('Catalog startup delay tests only run in exhaustive')
|
|
super(TestCatalogStartupDelay, cls).setup_class()
|
|
|
|
@pytest.mark.execute_serially
|
|
@CustomClusterTestSuite.with_args(
|
|
catalogd_args="--stress_catalog_startup_delay_ms=60000")
|
|
def test_default_metadata_settings(self):
|
|
"""This variant tests the default metadata settings."""
|
|
# The actual test here is successful startup, and we assume nothing about the
|
|
# functionality of the impalads before the catalogd finishes starting up.
|
|
self.execute_query("select count(*) from functional.alltypes")
|
|
|
|
@pytest.mark.execute_serially
|
|
@CustomClusterTestSuite.with_args(
|
|
impalad_args="--use_local_catalog=true",
|
|
catalogd_args="--stress_catalog_startup_delay_ms=60000 --catalog_topic_mode=minimal")
|
|
def test_local_catalog(self):
|
|
"""This variant tests with the local catalog."""
|
|
# The actual test here is successful startup, and we assume nothing about the
|
|
# functionality of the impalads before the catalogd finishes starting up.
|
|
self.execute_query("select count(*) from functional.alltypes")
|
|
|
|
@pytest.mark.execute_serially
|
|
@CustomClusterTestSuite.with_args(
|
|
num_exclusive_coordinators=1,
|
|
impalad_args="--use_local_catalog=true",
|
|
catalogd_args="--stress_catalog_startup_delay_ms=60000 --catalog_topic_mode=minimal")
|
|
def test_local_catalog_excl_coord(self):
|
|
"""This variant tests with the local catalog and an exclusive coordinator. The
|
|
purpose is to verify that executors do not break."""
|
|
# The actual test here is successful startup, and we assume nothing about the
|
|
# functionality of the impalads before the catalogd finishes starting up.
|
|
self.execute_query("select count(*) from functional.alltypes")
|