You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Gustav Grusell (JIRA)" <ji...@apache.org> on 2015/08/12 14:29:46 UTC

[jira] [Commented] (CASSANDRA-9467) cqlsh does not connect to older protocol versions

    [ https://issues.apache.org/jira/browse/CASSANDRA-9467?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14693410#comment-14693410 ] 

Gustav Grusell commented on CASSANDRA-9467:
-------------------------------------------

I tried a quick hack to allow specifying the protocol version for the cqlsh client on the command line, diff below. Is this a sensible fix for this issue, ?

{code}
diff --git a/bin/cqlsh.py b/bin/cqlsh.py
index 11f110d..7a180db 100644
--- a/bin/cqlsh.py
+++ b/bin/cqlsh.py
@@ -172,6 +172,7 @@ parser.add_option("--cqlshrc", help="Specify an alternative cqlshrc file locatio
 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("--protocolversion", default=DEFAULT_PROTOCOL_VERSION, help='Specify protocol version (default: %default).')
 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).')
@@ -2576,6 +2577,12 @@ def read_options(cmdlineargs, environment):
     except ValueError:
         parser.error('%r is not a valid port number.' % port)
 
+    if options.protocolversion:
+        try:
+            options.protocolversion = int(options.protocolversion)
+        except ValueError:
+            options.protocolversion=DEFAULT_PROTOCOL_VERSION
+
     return options, hostname, port
 
 
@@ -2652,7 +2659,9 @@ def main(options, hostname, port):
                       ssl=options.ssl,
                       single_statement=options.execute,
                       client_timeout=options.client_timeout,
-                      connect_timeout=options.connect_timeout)
+                      connect_timeout=options.connect_timeout,
+                      protocol_version=options.protocolversion
+    )
     except KeyboardInterrupt:
         sys.exit('Connection aborted.')
     except CQL_ERRORS, e:
{code}

> cqlsh does not connect to older protocol versions
> -------------------------------------------------
>
>                 Key: CASSANDRA-9467
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-9467
>             Project: Cassandra
>          Issue Type: Improvement
>         Environment: 2.2rc1 against 2.1 / 2.0
>            Reporter: Robert Stupp
>            Assignee: Stefania
>            Priority: Minor
>              Labels: cqlsh
>             Fix For: 3.x
>
>
> {{cqlsh}} (from curent 2.2 branch) does no longer work against C* 2.1 and 2.0.
> {code}
> bin/cqlsh 
> Connection error: ('Unable to connect to any servers', {'127.0.0.1': ConnectionException('Did not get expected SupportedMessage response; instead, got: Server protocol version (3) does not match the specified driver protocol version (4). Consider setting Cluster.protocol_version to 3.',)})
> {code}
> Related to CASSANDRA-9399 ?
> /cc [~stefania_alborghetti]



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)