Ao Chen created CASSGO-139:
------------------------------

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


*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