You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ty...@apache.org on 2015/07/09 19:31:17 UTC
[1/3] cassandra git commit: Backport CASSANDRA-9601 to 2.1
Repository: cassandra
Updated Branches:
refs/heads/trunk 55455dc65 -> 81ba56163
Backport CASSANDRA-9601 to 2.1
Patch by Stefania Alborghetti; reviewed by Benjamin Lerer; backported by
Tyler Hobbs for CASSANDRA-9601
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/19c00f72
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/19c00f72
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/19c00f72
Branch: refs/heads/trunk
Commit: 19c00f72125d8a9c0b716264caa33a68cf56741d
Parents: c4b5260
Author: Stefania Alborghetti <st...@datastax.com>
Authored: Wed Jul 8 10:46:05 2015 -0500
Committer: Tyler Hobbs <ty...@gmail.com>
Committed: Thu Jul 9 12:29:53 2015 -0500
----------------------------------------------------------------------
bin/cqlsh | 30 +++++++++++++++++++++++-------
1 file changed, 23 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/19c00f72/bin/cqlsh
----------------------------------------------------------------------
diff --git a/bin/cqlsh b/bin/cqlsh
index bf0f8fd..8f28a45 100755
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@ -132,6 +132,7 @@ DEFAULT_HOST = '127.0.0.1'
DEFAULT_PORT = 9042
DEFAULT_CQLVER = '3.2.0'
DEFAULT_PROTOCOL_VERSION = 3
+DEFAULT_CONNECT_TIMEOUT_SECONDS = 5
DEFAULT_TIME_FORMAT = '%Y-%m-%d %H:%M:%S%z'
DEFAULT_FLOAT_PRECISION = 5
@@ -169,6 +170,8 @@ parser.add_option('--cqlversion', default=DEFAULT_CQLVER,
help='Specify a particular CQL version (default: %default).'
' Examples: "3.0.3", "3.1.0"')
parser.add_option("-e", "--execute", help='Execute the statement and quit.')
+parser.add_option("--connect-timeout", default=DEFAULT_CONNECT_TIMEOUT_SECONDS, dest='connect_timeout',
+ help='Specify the connection timeout in seconds (default: %default seconds).')
optvalues = optparse.Values()
(options, arguments) = parser.parse_args(sys.argv[1:], values=optvalues)
@@ -585,7 +588,8 @@ class Shell(cmd.Cmd):
max_trace_wait=DEFAULT_MAX_TRACE_WAIT,
ssl=False,
single_statement=None,
- client_timeout=10):
+ client_timeout=10,
+ connect_timeout=DEFAULT_CONNECT_TIMEOUT_SECONDS):
cmd.Cmd.__init__(self, completekey=completekey)
self.hostname = hostname
self.port = port
@@ -606,7 +610,8 @@ class Shell(cmd.Cmd):
protocol_version=DEFAULT_PROTOCOL_VERSION,
auth_provider=self.auth_provider,
ssl_options=sslhandling.ssl_settings(hostname, CONFIG_FILE) if ssl else None,
- load_balancing_policy=WhiteListRoundRobinPolicy([self.hostname]))
+ load_balancing_policy=WhiteListRoundRobinPolicy([self.hostname]),
+ connect_timeout=connect_timeout)
self.owns_connection = not use_conn
self.set_expanded_cql_version(cqlver)
@@ -1672,7 +1677,8 @@ class Shell(cmd.Cmd):
auth_provider=self.auth_provider,
ssl_options=sslhandling.ssl_settings(self.hostname, CONFIG_FILE) if self.ssl else None,
load_balancing_policy=WhiteListRoundRobinPolicy([self.hostname]),
- compression=None)
+ compression=None,
+ connect_timeout=self.conn.connect_timeout)
session = new_cluster.connect(self.keyspace)
conn = session._pools.values()[0]._connection
@@ -2091,7 +2097,8 @@ class Shell(cmd.Cmd):
protocol_version=DEFAULT_PROTOCOL_VERSION,
auth_provider=auth_provider,
ssl_options=self.conn.ssl_options,
- load_balancing_policy=WhiteListRoundRobinPolicy([self.hostname]))
+ load_balancing_policy=WhiteListRoundRobinPolicy([self.hostname]),
+ connect_timeout=self.conn.connect_timeout)
if self.current_keyspace:
session = conn.connect(self.current_keyspace)
@@ -2263,7 +2270,6 @@ def option_with_default(cparser_getter, section, option, default=None):
except ConfigParser.Error:
return default
-
def raw_option_with_default(configs, section, option, default=None):
"""
Same (almost) as option_with_default() but won't do any string interpolation.
@@ -2321,12 +2327,20 @@ def read_options(cmdlineargs, environment):
optvalues.tty = sys.stdin.isatty()
optvalues.cqlversion = option_with_default(configs.get, 'cql', 'version', DEFAULT_CQLVER)
+ optvalues.connect_timeout = option_with_default(configs.getint, 'connection', 'timeout', DEFAULT_CONNECT_TIMEOUT_SECONDS)
optvalues.execute = None
(options, arguments) = parser.parse_args(cmdlineargs, values=optvalues)
hostname = option_with_default(configs.get, 'connection', 'hostname', DEFAULT_HOST)
port = option_with_default(configs.get, 'connection', 'port', DEFAULT_PORT)
+
+ try:
+ options.connect_timeout = int(options.connect_timeout)
+ except ValueError:
+ parser.error('{} is not a valid timeout.'.format(options.connect_timeout))
+ options.connect_timeout = DEFAULT_CONNECT_TIMEOUT_SECONDS
+
options.client_timeout = option_with_default(configs.get, 'connection', 'client_timeout', '10')
if options.client_timeout.lower() == 'none':
options.client_timeout = None
@@ -2420,7 +2434,8 @@ def main(options, hostname, port):
sys.exit("Can't open %r: %s" % (options.file, e))
if options.debug:
- sys.stderr.write("Using CQL driver: %s\n" % (cassandra,))
+ sys.stderr.write("Using CQL driver: {}\n".format(cassandra))
+ sys.stderr.write("Using connect timeout: {} seconds\n".format(options.connect_timeout))
try:
shell = Shell(hostname,
@@ -2438,7 +2453,8 @@ def main(options, hostname, port):
max_trace_wait=options.max_trace_wait,
ssl=options.ssl,
single_statement=options.execute,
- client_timeout=options.client_timeout)
+ client_timeout=options.client_timeout,
+ connect_timeout=options.connect_timeout)
except KeyboardInterrupt:
sys.exit('Connection aborted.')
except CQL_ERRORS, e:
[3/3] cassandra git commit: Merge branch 'cassandra-2.2' into trunk
Posted by ty...@apache.org.
Merge branch 'cassandra-2.2' into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/81ba5616
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/81ba5616
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/81ba5616
Branch: refs/heads/trunk
Commit: 81ba561630959969292d367642b120c4eb613b18
Parents: 55455dc 591216b
Author: Tyler Hobbs <ty...@gmail.com>
Authored: Thu Jul 9 12:31:07 2015 -0500
Committer: Tyler Hobbs <ty...@gmail.com>
Committed: Thu Jul 9 12:31:07 2015 -0500
----------------------------------------------------------------------
----------------------------------------------------------------------
[2/3] cassandra git commit: Merge branch 'cassandra-2.1' into
cassandra-2.2
Posted by ty...@apache.org.
Merge branch 'cassandra-2.1' into cassandra-2.2
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/591216bf
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/591216bf
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/591216bf
Branch: refs/heads/trunk
Commit: 591216bf6f67bd1fe23647ede31ab3c48d76f7cd
Parents: 136ffed 19c00f7
Author: Tyler Hobbs <ty...@gmail.com>
Authored: Thu Jul 9 12:30:46 2015 -0500
Committer: Tyler Hobbs <ty...@gmail.com>
Committed: Thu Jul 9 12:30:46 2015 -0500
----------------------------------------------------------------------
----------------------------------------------------------------------