thibaultcha / lua-cassandra

Pure Lua driver for Apache Cassandra
https://thibaultcha.github.io/lua-cassandra
Other
98 stars 35 forks source link

Retry logic doesn't match datastax recommendation #128

Open therapy-lf opened 5 years ago

therapy-lf commented 5 years ago

As it says in https://docs.datastax.com/en/developer/java-driver/3.2/manual/retries/#retries-and-idempotence

But looking into a code I see that it won't retry onUnavailable but in the same time it will on onWriteTimeout which is not safe: https://github.com/thibaultcha/lua-cassandra/blob/master/lib/resty/cassandra/cluster.lua#L727-L764 https://github.com/thibaultcha/lua-cassandra/blob/master/lib/resty/cassandra/policies/retry/simple.lua#L38-L48

Also, it is not pretty clear where those timeouts come https://github.com/thibaultcha/lua-cassandra/blob/master/lib/resty/cassandra/cluster.lua#L752

So, I have a few questions:

  1. Could it be possible that retry logic is broken or I'm wrong?
  2. Is it safe to retry request when those unknown timeouts occur and from where they might come?

Currently, we switched off the retry mechanism by setting retry_on_timeout to false and max_retries to one.

thibaultcha commented 3 years ago

The retry logic and the timeouts all come from the Datastax drivers that existed circa 2015 when this driver was implemented. I won't be updating the logic myself, but thanks for raising the issue!