jameshartig commented on code in PR #1793: URL: https://github.com/apache/cassandra-gocql-driver/pull/1793#discussion_r1937461606
########## 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: > On line [158](https://github.com/apache/cassandra-gocql-driver/blob/4a3a53b65f0726bc30fe14bac9be9baa8497c8ea/query_executor.go#L158) will continue loop iteration if the specified host is down, so it never reaches [179](https://github.com/apache/cassandra-gocql-driver/blob/4a3a53b65f0726bc30fe14bac9be9baa8497c8ea/query_executor.go#L179). Can you file that as a bug? That could affect the normal flow as well separate from this. We should be tracking the last host and maybe erroring if we get the same host twice. I don't think we need to alter this just because of that specific case. > Right, if we do this way retries will be disabled 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. -- 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: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org