[ 
https://issues.apache.org/jira/browse/CASSGO-139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18127743#comment-18127743
 ] 

Ao Chen commented on CASSGO-139:
--------------------------------

I opened [PR #1972|https://github.com/apache/cassandra-gocql-driver/pull/1972] 
to address this. It preserves the in-flight query when a speculative execution 
cannot find a usable host or connection, and includes regression tests for 
successful completion and caller deadlines.

> Speculative execution fails an in-flight query when no alternate host is 
> available
> ----------------------------------------------------------------------------------
>
>                 Key: CASSGO-139
>                 URL: https://issues.apache.org/jira/browse/CASSGO-139
>             Project: Apache Cassandra Go driver
>          Issue Type: Bug
>            Reporter: Ao Chen
>            Assignee: Ao Chen
>            Priority: Normal
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> *Description*
> When speculative execution starts while the original query is still running, 
> it may find no additional usable host and return {{{}ErrNoConnections{}}}. 
> The driver returns that error to the caller and cancels the original query, 
> even though the original could have completed successfully.
> This means enabling speculative execution can cause otherwise successful 
> queries to fail.
> *Steps to reproduce*
>  # Configure a session with one available host.
>  # Run an idempotent query that takes approximately 50 ms to complete.
>  # Enable one speculative execution with a 1 ms delay.
>  # The speculative execution cannot find another host and returns 
> {{{}ErrNoConnections{}}}.
> This can also happen in a multi-node cluster when the other eligible hosts 
> are unavailable.
> *Expected behavior*
> A speculative execution that cannot start a database attempt should not fail 
> the request. The driver should continue waiting for an active execution, 
> subject to the normal timeout or cancellation.
> *Actual behavior*
> The request fails with {{ErrNoConnections}} before the original query 
> finishes. In our reproduction, the query succeeds in approximately 52 ms 
> without speculation but fails in approximately 1.2 ms with it enabled.
> *Proposed fix*
> Track whether an execution started a database attempt. Do not publish a 
> speculative execution’s result if it never started an attempt. Preserve 
> existing error handling for executions that actually attempted the query.
> Add regression tests covering unavailable alternate hosts and genuine 
> execution errors.
> *References*
>  * Existing report: [GitHub issue 
> #1707|https://github.com/apache/cassandra-gocql-driver/issues/1707]
>  * Reproduced on upstream commit: 
> [{{94c308f}}|https://github.com/apache/cassandra-gocql-driver/commit/94c308f18566b3409f5b50e772804d6fecf439f4]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to