mirror of
https://github.com/apache/impala.git
synced 2026-01-30 06:00:18 -05:00
impala-shell does not set any socket timeout while connecting to the impala server. This change sets a timeout on the socket before connecting and unsets it back after successfully connecting. The default timeout on this socket is 5 sec. Usage: impala-shell --client_connect_timeout=<value in ms> Testing: 1. Added a test where I create a random listening socket. impala-shell (with ssl enabled) connects to this socket and times out after 2 sec. 2. Created a kerberized impala cluster with ssl enabled and connected to the impalad using an openssl client (block the beeswax server thread to accept new connection) - E.g. - openssl s_client -connect <IP Addr>:21000 Used impala-shell to connect to the same impalad later. impala-shell timed out after the default of 5 sec.I verified it manually. Change-Id: I130fc47f7a83f591918d6842634b4e5787d00813 Reviewed-on: http://gerrit.cloudera.org:8080/11540 Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
56 lines
1.9 KiB
Python
56 lines
1.9 KiB
Python
#!/usr/bin/env 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.
|
|
|
|
# defaults for OptionParser options stored in dict
|
|
|
|
import getpass
|
|
import os
|
|
import socket
|
|
|
|
_histfile_from_env = os.environ.get(
|
|
'IMPALA_HISTFILE', '~/.impalahistory')
|
|
|
|
impala_shell_defaults = {
|
|
'ca_cert': None,
|
|
'config_file': os.path.expanduser("~/.impalarc"),
|
|
'default_db': None,
|
|
'history_file': _histfile_from_env,
|
|
'history_max': 1000,
|
|
'ignore_query_failure': False,
|
|
'impalad': socket.getfqdn() + ':21000',
|
|
'kerberos_host_fqdn': None,
|
|
'kerberos_service_name': 'impala',
|
|
'output_delimiter': '\\t',
|
|
'output_file': None,
|
|
'print_header': False,
|
|
'print_progress' : False,
|
|
'print_summary' : False,
|
|
'query': None,
|
|
'query_file': None,
|
|
'show_profiles': False,
|
|
'ssl': False,
|
|
'use_kerberos': False,
|
|
'use_ldap': False,
|
|
'user': getpass.getuser(),
|
|
'verbose': True,
|
|
'version': False,
|
|
'write_delimited': False,
|
|
'client_connect_timeout_ms': 5000,
|
|
}
|