[
https://issues.apache.org/jira/browse/CASSGO-97?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18040657#comment-18040657
]
Bohdan Siryk commented on CASSGO-97:
------------------------------------
Technically, it just sends that simple sequence of OPTIONS -> response ->
STARTUP -> response -> AUTH... We need a recv loop because this is the way
gocql is designed to serve connections and distribute responses across
different goroutines.
The only thing here is that the Conn#recv method returns an error when the
stream ID of the received frame is 0. That
[comment|https://github.com/apache/cassandra-gocql-driver/blob/22ab88e75597baf630dc553439039ca1f2ad3bfc/conn.go#L725]
is interesting:
{code:java}
else if head.stream <= 0 {
// reserved stream that we dont use, probably due to a protocol error
// or a bug in Cassandra, this should be an error, parse it and return.
framer := newFramer(c.compressor, c.version, c.session.types)
if err := framer.readFrame(r, &head); err != nil {
return err
} {code}
_...due to protocol error..._ I'm trying to understand which protocol errors it
is referring to. As I understand, this is an actual place where gocql handles
*unsupported protocol version (X)* response. And then this
[method|https://github.com/apache/cassandra-gocql-driver/blob/22ab88e75597baf630dc553439039ca1f2ad3bfc/conn.go#L684]
returns a *protocolError* to recv, which returns an error to the startup
coordinator, which is then used to parse supported protocol versions. This
comment makes me think that the *stream id of 0* is guaranteed to be returned
if the driver tries to send a request with an unsupported proto version... Is
the case of *unsupported protocol version (X)* response documented anywhere? I
can't really find it...
> Protocol version negotiation doesn't work if server replies with stream id
> different than 0
> -------------------------------------------------------------------------------------------
>
> Key: CASSGO-97
> URL: https://issues.apache.org/jira/browse/CASSGO-97
> Project: Apache Cassandra Go driver
> Issue Type: Bug
> Components: Core
> Reporter: João Reis
> Priority: Normal
> Fix For: 2.x
>
>
> If the server's ProtocolError response comes with stream id 0 then [this
> code|https://github.com/apache/cassandra-gocql-driver/blob/0326fae3617dd19b901f2e9a97479c04fc11e05a/conn.go#L685-L700]
> will create the protocol error object.
> If the response comes with a positive stream id then [this
> code|https://github.com/apache/cassandra-gocql-driver/blob/0326fae3617dd19b901f2e9a97479c04fc11e05a/conn.go#L1314-L1330]
> will create the protocol error object. This latter way of creating the error
> makes [the regex check not
> work|https://github.com/apache/cassandra-gocql-driver/blob/0326fae3617dd19b901f2e9a97479c04fc11e05a/control.go#L210-L245].
> This was found when trying to connect to
> [ZDM-Proxy|https://github.com/datastax/zdm-proxy/] but connecting to a C*
> 3.11.x cluster works fine.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]