Merge branch 'cassandra-2.1' into trunk

This commit is contained in:
Mikhail Stepura 2014-07-12 14:21:08 +11:00
commit c61a7e4704
2 changed files with 11 additions and 2 deletions

View File

@ -20,6 +20,7 @@
* Fix NPE when unknown prepared statement ID is used (CASSANDRA-7454)
* Adjust MT depth based on # of partition validating (CASSANDRA-5263)
* Optimise NativeCell comparisons (CASSANDRA-6755)
* Configurable client timeout for cqlsh (CASSANDRA-7516)
2.1.0-final

View File

@ -467,7 +467,8 @@ class Shell(cmd.Cmd):
display_time_format=DEFAULT_TIME_FORMAT,
display_float_precision=DEFAULT_FLOAT_PRECISION,
ssl=False,
single_statement=None):
single_statement=None,
client_timeout=10):
cmd.Cmd.__init__(self, completekey=completekey)
self.hostname = hostname
self.port = port
@ -493,6 +494,7 @@ class Shell(cmd.Cmd):
self.session = self.conn.connect(keyspace)
else:
self.session = self.conn.connect()
self.session.default_timeout = client_timeout
self.get_connection_versions()
self.current_keyspace = keyspace
@ -1778,6 +1780,11 @@ def read_options(cmdlineargs, environment):
hostname = option_with_default(configs.get, 'connection', 'hostname', DEFAULT_HOST)
port = option_with_default(configs.get, 'connection', 'port', DEFAULT_PORT)
options.client_timeout = option_with_default(configs.get, 'connection', 'client_timeout', '10')
if options.client_timeout.lower() == 'none':
options.client_timeout = None
else:
options.client_timeout = int(options.client_timeout)
hostname = environment.get('CQLSH_HOST', hostname)
port = environment.get('CQLSH_PORT', port)
@ -1874,7 +1881,8 @@ def main(options, hostname, port):
display_time_format=options.time_format,
display_float_precision=options.float_precision,
ssl=options.ssl,
single_statement=options.execute)
single_statement=options.execute,
client_timeout=options.client_timeout)
except KeyboardInterrupt:
sys.exit('Connection aborted.')
except CQL_ERRORS, e: