smjn commented on code in PR #22601:
URL: https://github.com/apache/kafka/pull/22601#discussion_r3492906596
##########
server/src/main/java/org/apache/kafka/server/share/dlq/ShareGroupDLQStateManager.java:
##########
@@ -238,9 +250,18 @@ class ProduceRequestHandler implements
RequestCompletionHandler {
private static final Logger LOG =
LoggerFactory.getLogger(ShareGroupDLQStateManager.ProduceRequestHandler.class);
private final ExponentialBackoffManager createTopicsBackoff;
private final ExponentialBackoffManager produceRequestBackoff;
- private Node dlqPartitionLeaderNode;
- private int dlqDestinationPartition;
- private ShareGroupDLQMetadataCacheHelper.TopicPartitionData
dlqTopicPartitionData;
+ // These DLQ topic fields are written by populateDLQTopicData() and
read while building the
+ // produce request - both on the sender thread (from
dlqTopicExists()/handleCreateTopicsResponse()).
+ // Kept volatile defensively.
+ private volatile Node dlqPartitionLeaderNode;
+ private volatile int dlqDestinationPartition;
+ private volatile ShareGroupDLQMetadataCacheHelper.TopicPartitionData
dlqTopicPartitionData;
+ // The original source records, resolved once before this handler is
enqueued (see resolveRecords()).
+ // Volatile because resolution runs off the sender thread - on the
calling thread for local offsets
+ // and, for tiered offsets, on the remote-storage reader pool - while
this value is read on the
+ // sender thread when the produce request is built. Memoized: set once
and reused for every (re)send,
+ // so retries never re-fetch.
+ private volatile Map<Long, Record> resolvedRecordData = Map.of();
Review Comment:
since we want to store the records to make retries more efficient - we do
not want to fetch the records every time a dlq request is retried.
--
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]