SiyaoIsHiding commented on code in PR #2060:
URL:
https://github.com/apache/cassandra-java-driver/pull/2060#discussion_r2487821131
##########
core/src/main/java/com/datastax/oss/driver/api/core/tracker/RequestIdGenerator.java:
##########
@@ -67,6 +67,10 @@ default String getCustomPayloadKey() {
default Statement<?> getDecoratedStatement(
@NonNull Statement<?> statement, @NonNull String requestId) {
+ // in case of retry or speculative execution
+ if (statement.getCustomPayload().containsKey(getCustomPayloadKey())) {
Review Comment:
We should override instead of using the same ID for the node requests under
the same session request.
**TL;DR: In all of our ID generator implementations, the node request ID
already contains the session request ID in it.**
So let's say the session request ID is "4bf92f3577b34da6a3ce929d0e0e4736",
if we search `nodeRequestID.contains("4bf92f3577b34da6a3ce929d0e0e4736")`, we
will get all the retry/speculative executions for this session request, e.g.
"00-4bf92f3577b34da6a3ce929d0e0e4736-a3ce929d0e0e4736-01" or
00-4bf92f3577b34da6a3ce929d0e0e4736-0e4736a3ce929d0e-01"
This aligns with [W3C context
](https://www.w3.org/TR/trace-context/#trace-id), that the trace ID is the same
across the transasction, but span ID should be always unique.
This is also documented in our implementations.
https://github.com/apache/cassandra-java-driver/blob/f63108175fd22e2db893c57b0975bc518977ab4b/core/src/main/java/com/datastax/oss/driver/internal/core/tracker/UuidRequestIdGenerator.java#L35-L40
https://github.com/apache/cassandra-java-driver/blob/f63108175fd22e2db893c57b0975bc518977ab4b/core/src/main/java/com/datastax/oss/driver/internal/core/tracker/W3CContextRequestIdGenerator.java#L50-L57
Good catch from @lukasz-antoniak 🙏
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]