Kamal Chandraprakash created KAFKA-17797:
--------------------------------------------

             Summary: Use DelayedFuturePurgatory for RemoteListOffsetsPurgatory
                 Key: KAFKA-17797
                 URL: https://issues.apache.org/jira/browse/KAFKA-17797
             Project: Kafka
          Issue Type: Task
            Reporter: Kamal Chandraprakash


We are using the DelayedOperationPurgatory for remote-list-offsets. Each 
request is being tracked by multiple watch-keys: 
[listOffsetsRequestKeys|https://sourcegraph.com/github.com/apache/kafka/-/blob/core/src/main/scala/kafka/server/ReplicaManager.scala?L1561].
 



The watch-key is based on a topicPartition and the purgatory is checked on that 
key every time a remote listOffset task completes. However, the completion of 
such a task has no impact on other pending listOffset requests on the same 
partition.

The only reason we need the purgatory is really just for the expiration logic 
after the timeout if we chain all the futures together. Perhaps, using the 
pattern of DelayedFuturePurgatory is more intuitive. 

We could have a customized DelayedFuturePurgatory that also adds a delayed 
operation key per partition. But they are triggered for completion check when 
the replica is no longer the leader.
 
See: https://github.com/apache/kafka/pull/16602#discussion_r1792600283



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

Reply via email to