Skip to content

Conversation

@nikagra
Copy link

@nikagra nikagra commented Oct 17, 2025

Merging upstream commit 63b6d78:

Native Protocol 5 was introduced with the release of C* 4.0. This PR provides full support for a newer version including new format frames (segments), and new fields for QUERY, BATCH, and EXECUTE messages. Also, this PR brings changes to the Compressor interface to follow an append-like design. One more thing, it bumps Go version to the newer 1.19.

Patch by Bohdan Siryk; Reviewed by João Reis, James Hartig for CASSGO-1 CASSGO-30

These changes introduce functionality necessary to implement SCYLLA_USE_METADATA_ID protocol extension (see #527).

Extra changes:

  • Extracting CRC functionality into a package.
  • Removing headSize from framer.
  • Adding validation to ReadTimeout value in ClusterConfig
  • Adding .vscode to .gitignore.

@nikagra nikagra requested a review from dkropachev October 17, 2025 18:13
@nikagra nikagra force-pushed the merge-upstream-changes branch from d894ba4 to b5ee23f Compare October 17, 2025 18:18
@mykaul
Copy link

mykaul commented Oct 18, 2025

Native Protocol 5 was introduced with the release of C* 4.0. This PR provides full support for a newer version including new format frames (segments), and new fields for QUERY, BATCH, and EXECUTE messages. Also, this PR brings changes to the Compressor interface to follow an append-like design. One more thing, it bumps Go version to the newer 1.19.

What's the value of the v5 protocol?

@dkropachev
Copy link
Collaborator

Native Protocol 5 was introduced with the release of C* 4.0. This PR provides full support for a newer version including new format frames (segments), and new fields for QUERY, BATCH, and EXECUTE messages. Also, this PR brings changes to the Compressor interface to follow an append-like design. One more thing, it bumps Go version to the newer 1.19.

What's the value of the v5 protocol?

It will allow to test modern Cassandra side by side, bring proper metadata handling, which we will use in next pr.
And I hope, eventually we are going to get cql5 too.

@mykaul
Copy link

mykaul commented Oct 18, 2025

Native Protocol 5 was introduced with the release of C* 4.0. This PR provides full support for a newer version including new format frames (segments), and new fields for QUERY, BATCH, and EXECUTE messages. Also, this PR brings changes to the Compressor interface to follow an append-like design. One more thing, it bumps Go version to the newer 1.19.

What's the value of the v5 protocol?

It will allow to test modern Cassandra side by side, bring proper metadata handling, which we will use in next pr. And I hope, eventually we are going to get cql5 too.

For proper metada handling we need this change to the wire protocol? v5 doesn't seem to be providing huge value, maybe I'm missing something. Modern cassandra isn't exciting. CQL5 - I'm not sure it's on our todo list just yet.

@dkropachev
Copy link
Collaborator

Native Protocol 5 was introduced with the release of C* 4.0. This PR provides full support for a newer version including new format frames (segments), and new fields for QUERY, BATCH, and EXECUTE messages. Also, this PR brings changes to the Compressor interface to follow an append-like design. One more thing, it bumps Go version to the newer 1.19.

What's the value of the v5 protocol?

It will allow to test modern Cassandra side by side, bring proper metadata handling, which we will use in next pr. And I hope, eventually we are going to get cql5 too.

For proper metada handling we need this change to the wire protocol? v5 doesn't seem to be providing huge value, maybe I'm missing something. Modern cassandra isn't exciting. CQL5 - I'm not sure it's on our todo list just yet.

We don't need it, but if we don't bring CQL5 now, later we will have to deal with rewiring metadata updates when CQL5 going to get it, which will make it way harder, out of experience with other drivers I can tell that bringing CQL5 first and then implementing metadata update feature way easier than otherway around.

@nikagra nikagra force-pushed the merge-upstream-changes branch 2 times, most recently from 80e1137 to 18a0652 Compare October 27, 2025 18:20
Native Protocol 5 was introduced with the release of C* 4.0. This PR provides full support
for a newer version including new format frames (segments), and new fields for QUERY, BATCH, and EXECUTE messages.
Also, this PR brings changes to the Compressor interface to follow an append-like design.
One more thing, it bumps Go version to the newer 1.19.

Patch by Bohdan Siryk; Reviewed by João Reis, James Hartig for CASSGO-1 CASSGO-30
@nikagra nikagra force-pushed the merge-upstream-changes branch from e7022a5 to 5a76087 Compare October 29, 2025 16:56
@nikagra nikagra changed the title CASSGO 1 Support for Native Protocol 5 Merge upstream commit 63b6d78: "CASSGO 1 Support for Native Protocol 5" Oct 30, 2025
…y to internal package. Integration tests config changes. Reverting unwanted merge changes.

Detailed summary:
- Moving CRC functionality to internal package.
- Update test cluster hosts to match CCM-created cluster
    - Update flagCluster default from 127.0.0.1 to 127.0.2.1,127.0.2.2,127.0.2.3 to align with the 3-node cluster configuration created by CCM. Fixes connection refused errors in integration tests.
- Adding validation to `ReadTimeout` value in `ClusterConfig`
- Removing `headSize` from `framer`.
- Adding `.vscode` to `.gitignore`.
@nikagra nikagra force-pushed the merge-upstream-changes branch from 5a76087 to a2cb754 Compare October 30, 2025 12:35
@nikagra nikagra marked this pull request as ready for review October 30, 2025 12:36
@nikagra nikagra changed the title Merge upstream commit 63b6d78: "CASSGO 1 Support for Native Protocol 5" [#591] Merge upstream commit 63b6d78: "CASSGO 1 Support for Native Protocol 5" Oct 30, 2025
control.go Outdated
hosts = shuffleHosts(hosts)

connCfg := *c.session.connCfg
connCfg.ProtoVersion = protoVersion4 // TODO: define maxProtocol
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please set it to 5

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is still protoVersion4

text string
)

q := session.Query("SELECT * FROM gocql_query_keyspace_override_test.query_keyspace").
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove ks from the query.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is still there.

id = 0
text = ""

q = session.Query("SELECT * FROM gocql_query_keyspace_override_test.query_keyspace").
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove ks from the query.

common_test.go Outdated

var (
flagCluster = flag.String("cluster", "127.0.0.1", "a comma-separated list of host:port tuples")
flagCluster = flag.String("cluster", "127.0.2.1,127.0.2.2,127.0.2.3", "a comma-separated list of host:port tuples")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please roll it back

conn.go Outdated
Comment on lines 767 to 769
if c.r.GetTimeout() > 0 {
c.r.SetReadDeadline(time.Time{})
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one does not make any sense to have it here, it will be overridden on next .Read call on the reader, please drop it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do the following instead, on first io.ReadFull(r, p[:1]) in the readHeader(r io.Reader, p []byte) (head frameHeader, err error) let's handle read timeout and wrap/or return an error that signals that it is an expected situation and handle it gracefully on serve(ctx context.Context).

The problem is the following, if there is no traffic serve(ctx context.Context) is still calling readHeader, in which situation it is ok to get timeout on reading begging of the frame.

conn.go Outdated

// ConnReader is like net.Conn but also allows to set timeout duration.
type ConnReader interface {
net.Conn
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove net.Conn and add only methods that are used.

conn.go Outdated
Comment on lines 1021 to 1023
func (c *connReader) LocalAddr() net.Addr {
return c.conn.LocalAddr()
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not used, drop it

conn.go Outdated
return c.conn.RemoteAddr()
}

func (c *connReader) SetDeadline(t time.Time) error {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not used, drop it

conn.go Outdated
Comment on lines 1033 to 1035
func (c *connReader) SetReadDeadline(t time.Time) error {
return c.conn.SetReadDeadline(t)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should not be used, please drop it.

conn.go Outdated
Comment on lines 1037 to 1039
func (c *connReader) SetWriteDeadline(t time.Time) error {
return c.conn.SetWriteDeadline(t)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SetWriteDeadline on a connReader ? Please drop it.

…nhancements. Refactor keyspace handling in `TestQuery_SetKeyspace`
@nikagra nikagra requested a review from dkropachev November 4, 2025 17:32
Copy link
Collaborator

@dkropachev dkropachev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please go over all the comments, make sure they are fixed.

control.go Outdated
hosts = shuffleHosts(hosts)

connCfg := *c.session.connCfg
connCfg.ProtoVersion = protoVersion4 // TODO: define maxProtocol
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is still protoVersion4

text string
)

q := session.Query("SELECT * FROM gocql_query_keyspace_override_test.query_keyspace").
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is still there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants