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

Adam Holmberg commented on CASSANDRA-16508:
-------------------------------------------

Proposing a very simple patch. It removes explicitly setting 
{{protocol_version}} in {{cqlsh}} and leaves downgrading to the driver.

The explicit set was only [added with some v5 
work|https://github.com/apache/cassandra/commit/a7c4ba9eeecb365e7c4753d8eaab747edd9a632a#diff-9e4fe0cfd28004625a8006be8a0bdeab8cbdfb039449fb9501b15e8952577aaaR478],
 and I think was only necessary when v5 was in beta. It was later set to 5 
after v5 was promoted out of beta, and that's when it would have stopped 
working with lesser C* versions.

I've tested locally with versions back through 2.1 and verified that it 
connects and arrives at the correct protocol version:
{noformat}
Connected to Test Cluster at 127.0.0.1:9042
[cqlsh 6.0.0 | Cassandra 2.1.23-SNAPSHOT | CQL spec 3.2.1 | Native protocol v3]
{noformat}
{noformat}
Connected to Test Cluster at 127.0.0.1:9042
[cqlsh 6.0.0 | Cassandra 2.2.20-SNAPSHOT | CQL spec 3.3.1 | Native protocol v4]
{noformat}
{noformat}
Connected to Test Cluster at 127.0.0.1:9042
[cqlsh 6.0.0 | Cassandra 3.0.25-SNAPSHOT | CQL spec 3.4.0 | Native protocol v4]
{noformat}
{noformat}
Connected to Test Cluster at 127.0.0.1:9042
[cqlsh 6.0.0 | Cassandra 3.11.11-SNAPSHOT | CQL spec 3.4.4 | Native protocol v4]
{noformat}
{noformat}
Connected to Test Cluster at 127.0.0.1:9042
[cqlsh 6.0.0 | Cassandra 4.0-beta5-SNAPSHOT | CQL spec 3.4.5 | Native protocol 
v5]
{noformat}

[patch|https://github.com/aholmberg/cassandra/pull/47]
[ci|https://app.circleci.com/pipelines/github/aholmberg/cassandra?branch=CASSANDRA-16508]


> Running cqlsh against cassandra 3 throws error about beta flag not set
> ----------------------------------------------------------------------
>
>                 Key: CASSANDRA-16508
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-16508
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL/Interpreter
>            Reporter: Jeff Widman
>            Assignee: Adam Holmberg
>            Priority: Normal
>             Fix For: 4.0-rc
>
>
> I just ran `cqlsh` from `trunk` commit 
> 2aa22ba99dcc1dacb07b7af31b2664e7db839063 against a Cassandra 3.11.10 docker 
> image.
> I expected that the newer cqlsh would down-negotiate from the v5 protocol to 
> the older v4 protocol.
> Instead, I was surprised to get a server error about a beta protocol being 
> used without `BETA_FLAG` being set. I unfortunately had to reboot my 
> computer, so I lost the traceback but I can easily reproduce if needed.
> I think what's happening is that this commit promoted v5 out of beta:
> https://github.com/apache/cassandra/commit/c9d6c725dd0b4aa5693eb1c6d2221c28e9e99c6e#diff-9e4fe0cfd28004625a8006be8a0bdeab8cbdfb039449fb9501b15e8952577aaaL479
> And then when it tries to contact the older cassandra version, the server 
> complains that it received a request using the v5 protocol without this beta 
> flag being set.
> However, I was expecting that cqlsh would catch the error and down-negotiate 
> to v4. Instead, it simply returns the error with no message about how to 
> solve. As someone relatively new to `cqlsh`, I assumed at first there was no 
> workaround except for downgrading my version of `cqlsh`. After some googling, 
> I stumbled across a stackoverflow pointing toward the `--cqlversion` flag.
> Given that this was the first cqlsh to support python 3, it means that anyone 
> trying to use python 3 for cqlsh against cassandra 3.x will hit this weird 
> error. There is no alternative if you want to use python 3.
> My suggested fix is to catch the error and either prompt the user with 
> something like _Perhaps you want to manually specify a different cql protocol 
> version using the `--cqlversion` flag?_ or simply auto-down negotiate to 
> version 4 (although I understand why auto-down-negotiating may not be the 
> right move).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to