mirror of
https://github.com/apache/impala.git
synced 2025-12-20 10:29:58 -05:00
Adds a flag --rpc_use_loopback that causes two differences in behaviour when enabled: 1. KRPC will listen on all interfaces, i.e. bind the socket to INADDR_ANY. 2. KRPC RPCs to --hostname are sent to 127.0.0.1 instead of the IP (maybe external) that --hostname resolves to. There is no change in default behaviour, except in containers, where this flag is enabled by default. Testing: * Added a custom cluster test, which runs in exhaustive, as a sanity test for the behaviour of the flag. Change-Id: I9dbd477769ed49c05e624f06da4e51afaaf1670d Reviewed-on: http://gerrit.cloudera.org:8080/13592 Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
51 lines
1.8 KiB
Python
51 lines
1.8 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.
|
|
|
|
import pytest
|
|
import socket
|
|
from tests.common.custom_cluster_test_suite import CustomClusterTestSuite
|
|
from tests.common.impala_cluster import DEFAULT_KRPC_PORT
|
|
|
|
|
|
class TestKrpcOptions(CustomClusterTestSuite):
|
|
"""Test for different options when using KRPC."""
|
|
|
|
@classmethod
|
|
def get_workload(self):
|
|
return 'functional-query'
|
|
|
|
@classmethod
|
|
def setup_class(cls):
|
|
if cls.exploration_strategy() != 'exhaustive':
|
|
pytest.skip('runs only in exhaustive')
|
|
super(TestKrpcOptions, cls).setup_class()
|
|
|
|
@pytest.mark.execute_serially
|
|
@CustomClusterTestSuite.with_args("--rpc_use_loopback=true")
|
|
def test_krpc_use_loopback(self, vector):
|
|
"""Sanity test for the --rpc_use_loopback flag."""
|
|
# Run a query that will execute on multiple hosts.
|
|
self.client.execute("select min(int_col) from functional_parquet.alltypes")
|
|
|
|
# Check that we can connect on multiple interfaces.
|
|
sock = socket.socket()
|
|
sock.connect(("127.0.0.1", DEFAULT_KRPC_PORT))
|
|
sock.close()
|
|
sock = socket.socket()
|
|
sock.connect((socket.gethostname(), DEFAULT_KRPC_PORT))
|
|
sock.close()
|