Description
Looking at the "exec()" method of "Conn" in "conn.go", it seems like there's two ways we can hit a timeout condition when a Context with a deadline is provided to the Query.
As I understand it, the "Session" ClusterConfig.Timeout value is propagated to Conn which is used in the "timeoutCh" and and the Query's context is used for "ctxDone". Coming from the Datastax drivers, this is unexpected behavior.
For example, from the Python driver docs on session.default_timeout
default_timeout = 10.0
A default timeout, measured in seconds, for queries executed through execute() or execute_async(). This default may be overridden with the timeout parameter for either of those methods.
Source: https://datastax.github.io/python-driver/api/cassandra/cluster.html#cassandra.cluster.Session
We don't have to copy the same behavior, but expectations are a bit unclear. I think one of the following can be done:
- better documentation/best practices around
ClusterConfig.Timeout
and/orQuery().WithContext
and timeouts. E.g. Session timeout should be 0 or very large when using Contexts to manage timeout limits. - When Context is provided, ignore the Conn.timeout and/or call a separate 'Conn' method that only respects the context timeout, errors, and quits of the connection.