You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by mc...@apache.org on 2017/04/18 07:31:02 UTC
cassandra git commit: Fix cqlsh automatic protocol downgrade
regression Patch by Matt Byrd; reviewed by Mick Semb Wever for CASSANDRA-13307
Repository: cassandra
Updated Branches:
refs/heads/trunk 74bdf633e -> 8f5f54fb1
Fix cqlsh automatic protocol downgrade regression
Patch by Matt Byrd; reviewed by Mick Semb Wever for CASSANDRA-13307
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8f5f54fb
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8f5f54fb
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/8f5f54fb
Branch: refs/heads/trunk
Commit: 8f5f54fb1c6b32e1dceacb4e694c414d3583a419
Parents: 74bdf63
Author: Matt Byrd <ma...@apple.com>
Authored: Wed Mar 8 13:55:01 2017 -0800
Committer: mck <mi...@thelastpickle.com>
Committed: Tue Apr 18 17:12:50 2017 +1000
----------------------------------------------------------------------
CHANGES.txt | 1 +
bin/cqlsh.py | 19 +++++++++++++------
2 files changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8f5f54fb/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index dae275f..adbaf84 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -52,6 +52,7 @@
* cqlsh auto completion: refactor definition of compaction strategy options (CASSANDRA-12946)
* Add support for arithmetic operators (CASSANDRA-11935)
* Add histogram for delay to deliver hints (CASSANDRA-13234)
+ * Fix cqlsh automatic protocol downgrade regression (CASSANDRA-13307)
3.11.0
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8f5f54fb/bin/cqlsh.py
----------------------------------------------------------------------
diff --git a/bin/cqlsh.py b/bin/cqlsh.py
index bd62072..28e8043 100644
--- a/bin/cqlsh.py
+++ b/bin/cqlsh.py
@@ -178,7 +178,6 @@ from cqlshlib.util import get_file_encoding_bomsize, trim_if_present
DEFAULT_HOST = '127.0.0.1'
DEFAULT_PORT = 9042
DEFAULT_SSL = False
-DEFAULT_PROTOCOL_VERSION = 4
DEFAULT_CONNECT_TIMEOUT_SECONDS = 5
DEFAULT_REQUEST_TIMEOUT_SECONDS = 10
@@ -223,6 +222,9 @@ parser.add_option('--cqlversion', default=None,
help='Specify a particular CQL version, '
'by default the highest version supported by the server will be used.'
' Examples: "3.0.3", "3.1.0"')
+parser.add_option("--protocol-version", type="int", default=None,
+ help='Specify a specific protcol version otherwise the client will default and downgrade as necessary')
+
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).')
@@ -449,7 +451,7 @@ class Shell(cmd.Cmd):
ssl=False,
single_statement=None,
request_timeout=DEFAULT_REQUEST_TIMEOUT_SECONDS,
- protocol_version=DEFAULT_PROTOCOL_VERSION,
+ protocol_version=None,
connect_timeout=DEFAULT_CONNECT_TIMEOUT_SECONDS):
cmd.Cmd.__init__(self, completekey=completekey)
self.hostname = hostname
@@ -468,13 +470,16 @@ class Shell(cmd.Cmd):
if use_conn:
self.conn = use_conn
else:
+ kwargs = {}
+ if protocol_version is not None:
+ kwargs['protocol_version'] = protocol_version
self.conn = Cluster(contact_points=(self.hostname,), port=self.port, cql_version=cqlver,
- protocol_version=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]),
control_connection_timeout=connect_timeout,
- connect_timeout=connect_timeout)
+ connect_timeout=connect_timeout,
+ **kwargs)
self.owns_connection = not use_conn
if keyspace:
@@ -1673,9 +1678,9 @@ class Shell(cmd.Cmd):
direction = parsed.get_binding('dir').upper()
if direction == 'FROM':
- task = ImportTask(self, ks, table, columns, fname, opts, DEFAULT_PROTOCOL_VERSION, CONFIG_FILE)
+ task = ImportTask(self, ks, table, columns, fname, opts, self.conn.protocol_version, CONFIG_FILE)
elif direction == 'TO':
- task = ExportTask(self, ks, table, columns, fname, opts, DEFAULT_PROTOCOL_VERSION, CONFIG_FILE)
+ task = ExportTask(self, ks, table, columns, fname, opts, self.conn.protocol_version, CONFIG_FILE)
else:
raise SyntaxError("Unknown direction %s" % direction)
@@ -2231,6 +2236,7 @@ def read_options(cmdlineargs, environment):
optvalues.encoding = option_with_default(configs.get, 'ui', 'encoding', UTF8)
optvalues.tty = option_with_default(configs.getboolean, 'ui', 'tty', sys.stdin.isatty())
+ optvalues.protocol_version = option_with_default(configs.getint, 'protocol', 'version', None)
optvalues.cqlversion = option_with_default(configs.get, 'cql', 'version', None)
optvalues.connect_timeout = option_with_default(configs.getint, 'connection', 'timeout', DEFAULT_CONNECT_TIMEOUT_SECONDS)
optvalues.request_timeout = option_with_default(configs.getint, 'connection', 'request_timeout', DEFAULT_REQUEST_TIMEOUT_SECONDS)
@@ -2384,6 +2390,7 @@ def main(options, hostname, port):
tty=options.tty,
completekey=options.completekey,
browser=options.browser,
+ protocol_version=options.protocol_version,
cqlver=options.cqlversion,
keyspace=options.keyspace,
display_timestamp_format=options.time_format,