worryg0d commented on code in PR #1793:
URL: 
https://github.com/apache/cassandra-gocql-driver/pull/1793#discussion_r1941037021


##########
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 spent more time on this and found a way to avoid endless executions when 
`SetHostID()` is used with the downed host. I pushed in on my other branch 
[here](https://github.com/apache/cassandra-gocql-driver/commit/0e44de86776a74500aaae5f9cf18d9433a755e23).
 Could you please take a look and share your thoughts? 
   
   Ofc this issue is still relevant when `HostSelectionPolicy` returns downed 
nodes. At least, this will resolve the described issue with `SetHostID()`. 
Thanks a lot to @ribaraka who pointed to this approach.



-- 
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

Reply via email to