-
Notifications
You must be signed in to change notification settings - Fork 623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Keyspace/Table name in prepared Query statement #1714
Conversation
0354152
to
5644ec0
Compare
5644ec0
to
29547f4
Compare
85d3da3
to
f420b60
Compare
a22ba29
to
9cda9c0
Compare
6c946c3
to
0580053
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the pull request!
The change looks good to me in general, I added just one comment regarding error handling in the test.
Could you please also update the AUTHORS and CHANGELOG.md files as per CONTRIBUTING.md?
9dfe898
to
9760902
Compare
Previously TokenAwarePolicy always used Keyspace explicitly set in cluster.Keyspace regardless of the keyspace in the Query. Now after preparing statement Keyspace and Table names are transferred to the Query and it can make use of that. Fixes: apache#1621
9760902
to
65f29c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thank you!
Setting the keyspace explicitly was done to workaround the following bug: apache/cassandra-gocql-driver#1621 After fixing this bug it is not necessary anymore. (PR fixing it: apache/cassandra-gocql-driver#1714)
Previously
gocql.TokenAwareHostPolicy
always used keyspace explicitly specified in.Keyspace
inClusterConfig
regardless of the keyspace in the Query. This would mean that the token awareness feature would not work properly if the user did not specify.Keyspace
inClusterConfig
or did a query to a different keyspace.This PR introduces transferring Keyspace and Table names to the Query from the PREPARED response and updating information about that every time this information is received. After this change, the token awareness feature can work properly without user having to specify a keyspace in
ClusterConfig
.I created automated integration test (
keyspace_table_test.go
) on 3 nodes cluster.Fixes: #1621