-
Notifications
You must be signed in to change notification settings - Fork 622
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
CASSGO-27 gocql RetryPolicies still don't use query idempotence #1803
Comments
I will check it, but could you please provide more details. How you tested it, versions of C*, golang, and gocql, etc. |
What version of Cassandra are you using?scylladb 5.1.19 What version of Gocql are you using?fork scylladb/gocql v1.12.0 ( includes v1.6.0 gocql/gocql) What version of Go are you using?1.21 |
my project does not set Idempotent ¶ (not intentionally ) but we expect retries none of the implemented retry policies use this query method - https://github.com/apache/cassandra-gocql-driver/blob/trunk/policies.go |
Do you expect the retry of non-idempotent queries or not? I could not clearly understand expected behaviour. The ticket you mentioned was implementing speculative retry policy, which is something different. Retry policy in Java driver is:
Retry policy implementations do not need to check idempotency flag. IMHO same logic shall apply in GoCQL. Retry policy shall not be even invoked for non0idempotent write operations. Do I understand the issue correctly? If so, I will submit a fix for it. |
I expect that https://pkg.go.dev/github.com/gocql/gocql#Query with IsIdempotent ¶ returning false will not be retried.
From this issue #1153 I understood that #1083 contains work on speculative execution and #1154 was supposed to support non-idempotent queries in retries ? Otherwise issue #1153 should not have been closed.
I am not sure we should think too much about read/write ops here , gocql Query is the same for them and does not provide convenient way to check if query writes or reads data. I think gocql should just check method IsIdempotent and trust user to fill this field correctly ? |
I have tested it and found that Queries is not idempotent by default |
Was this a write or read query ? Just checking because write timeout is not retried in DowngradingConsistencyRetryPolicy if some nodes responded. |
I tested retries with gocql.DowngradingConsistencyRetryPolicy{ConsistencyLevelsToTry: []gocql.Consistency{ gocql.One}} and CL=Quorum with 2 nodes one of which is down. First attempt gets an error (read/write get the same error)
and on retry observer logs attempt with lower CL (this one is successful)
Our Query does not set Idempotent so it shouldn't have been retried
We also don't change DefaultIdempotence in cluster config |
Please share an exec query you are using to reproduce the issue, if you tried multiple queries provide them as well. |
Something like that on read
I will try to find time on weekends to create an easier example in some sandbox |
Hi I have an axample main.go (go 1.21.11 , github.com/gocql/gocql v1.6.0) there is a loop to wait for scylladb start and second loop to have time to down one of the nodes
cql init for scylla
docker-compose for nodes and main.go
I can see in log that query is retried
|
@Rikkuru Thank you for providing the details. I reproduced the issue you faced, and as you said, according to documentation it's misbehavior. I added a small fix, retested it and it works properly now. |
Issue #1154 was meant to add idempotence check in gocql RetryPolicies
Issue was closed but Retry Policies still don't check if query IsIdempotent BUT documentations states that IsIdempotent affects retries
Need to implement this logic or change documentation
The text was updated successfully, but these errors were encountered: