worryg0d commented on code in PR #1793:
URL:
https://github.com/apache/cassandra-gocql-driver/pull/1793#discussion_r1937483621
##########
query_executor.go:
##########
@@ -83,7 +84,27 @@ func (q *queryExecutor) speculate(ctx context.Context, qry
ExecutableQuery, sp S
}
func (q *queryExecutor) executeQuery(qry ExecutableQuery) (*Iter, error) {
- hostIter := q.policy.Pick(qry)
+ var hostIter NextHost
+
+ // check if the host id is specified for the query,
+ // if it is, the query should be executed at the corresponding host.
+ if hostID := qry.GetHostID(); hostID != "" {
+ pool, ok := q.pool.getPoolByHostID(hostID)
+ if !ok || !pool.host.IsUp() {
+ return &Iter{err: ErrNoConnections}, nil
+ }
+ hostIter = func() SelectedHost {
+ // forcing hostIter to always return the same host
+ // it makes any retries and speculative executions run
on the specified host
Review Comment:
> I still think we should be aiming to make retries work, even if its in a
follow-up issue. There are transient things that happen in the real world that
might be annoying to handle if we just always disable retries.
I agree, we can't just force disable them. If users really need to disable
them, they can do it. There is a way to do it via `Idempotent()` and
`RetryPolicy()`.
> We should be tracking the last host and maybe erroring if we get the same
host twice
If we do so, it will break `DowngradingConsistencyRetryPolicy` which returns
the retry type `Retry` which indicates that the driver should retry on the same
host. It is described
[here](https://github.com/apache/cassandra-gocql-driver/blob/4a3a53b65f0726bc30fe14bac9be9baa8497c8ea/query_executor.go#L201)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]