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

Bret McGuire commented on CASSJAVA-116:
---------------------------------------

Added KeyspaceCount.java, a repro case of the problem using the Astra hosted 
service.  Local testing confirms that Java driver 4.19.1 fails with the error 
message described in this ticket while the soon-to-be-released (as of this 
writing) 4.19.2 does not.

> Retry or Speculative Execution with RequestIdGenerator throws "Duplicate Key"
> -----------------------------------------------------------------------------
>
>                 Key: CASSJAVA-116
>                 URL: https://issues.apache.org/jira/browse/CASSJAVA-116
>             Project: Apache Cassandra Java driver
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Jane He
>            Assignee: Jane He
>            Priority: Urgent
>             Fix For: 4.19.2
>
>         Attachments: KeyspaceCount.java
>
>          Time Spent: 4h 10m
>  Remaining Estimate: 0h
>
> Exception looks something like the following:
>  
> {code:java}
> java.lang.IllegalArgumentException: Duplicate key traceparent
>       at 
> com.datastax.oss.protocol.internal.util.collection.NullAllowingImmutableMap$Builder.failIfDuplicateKeys(NullAllowingImmutableMap.java:226)
>  ~[native-protocol-1.5.2.jar:?]
>       at 
> com.datastax.oss.protocol.internal.util.collection.NullAllowingImmutableMap$Builder.build(NullAllowingImmutableMap.java:198)
>  ~[native-protocol-1.5.2.jar:?]
>       at 
> com.datastax.oss.driver.api.core.tracker.RequestIdGenerator.getDecoratedStatement(RequestIdGenerator.java:74)
>  ~[java-driver-core-4.19.1.jar:4.19.1]
>       at 
> com.datastax.oss.driver.internal.core.cql.CqlRequestHandler.lambda$sendRequest$3(CqlRequestHandler.java:291)
>  ~[java-driver-core-4.19.1.jar:4.19.1] {code}
>  
> It's because CqlRequestHandler can call {{sendRequest}} more than one time, 
> so "getDecoreatedStatement" can be called more than one time, so there will 
> be duplicate key.
> We should modify the {{RequestIdGenerator.getDecoratedStatement}}  so that
>  
> {code:java}
> if (statement.getCustomPayload().containsKey(getCustomPayloadKey()))
> { return statement; }
>  
> {code}
>  
> This is a serious bug, we should release the fix ASAP.
>  
>  



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