Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KAFKA-17703: Moved DelayedActionsQueue outside DelayedShareFetch #17380

Merged
merged 5 commits into from
Oct 9, 2024

Conversation

adixitconfluent
Copy link
Contributor

@adixitconfluent adixitconfluent commented Oct 5, 2024

About

In reference to comments #17177 (comment) and #17177 (comment) , this PR addresses the following -

  1. Move ActionQueue outside DelayedShareFetch class to SharePartitionManager where SharePartitionManager has the ability to add a delayed action to the ActionQueue.

  2. Add TopicPartition as a key for delayed share fetch along with SharePartition (that is already present right now). This will be utilized later when we add the code to know if new data has been added to the topic partition.

Testing

The code has been tested with the help of unit tests.

@github-actions github-actions bot added core Kafka Broker small Small PRs labels Oct 5, 2024
@adixitconfluent adixitconfluent marked this pull request as ready for review October 5, 2024 10:38
@apoorvmittal10 apoorvmittal10 added the KIP-932 Queues for Kafka label Oct 7, 2024
Copy link
Collaborator

@apoorvmittal10 apoorvmittal10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Left some comments.

Copy link
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adixitconfluent : Thanks for the PR. A couple of comments.

@junrao
Copy link
Contributor

junrao commented Oct 7, 2024

@adixitconfluent : Currently, we check the produce/fetch purgatory when a replica becomes the follower or a replica is deleted from a broker through ReplicaManager. applyLocalFollowersDelta and ReplicaManager.applyDelta. Should we do the same for share purgatory?

@github-actions github-actions bot removed the small Small PRs label Oct 8, 2024
@adixitconfluent
Copy link
Contributor Author

adixitconfluent commented Oct 8, 2024

@adixitconfluent : Currently, we check the produce/fetch purgatory when a replica becomes the follower or a replica is deleted from a broker through ReplicaManager. applyLocalFollowersDelta and ReplicaManager.applyDelta. Should we do the same for share purgatory?

@junrao , yes, I think we should do it. Moreover, with more use cases of delayed share fetch purgatory within ReplicaManager functionalities like -

  1. Above use cases you mentioned
  2. Perform a checkAndComplete when HWM is updated
  3. Perform a shutdown of the delayed share fetch purgatory like the others in ReplicaManager
    I feel its better we declare the delayed share fetch purgatory inside ReplicaManager along with the existing purgatories. We don't need a reference to this purgatory outside of ReplicaManager, we can just add accessor methods. What do you think?

@adixitconfluent adixitconfluent requested a review from junrao October 8, 2024 07:20
Copy link
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adixitconfluent : Thanks for the updated PR. A few more comments.

Also, there seems to be another existing issue. If a sharePartition is being initialized, any pending shareFetchRequest is blocked in the purgatory. So, after the initialization completes, we need to trigger a check in the share fetch purgatory to wake up pending delayed operations.

*/
public class DelayedShareFetchGroupKey implements DelayedShareFetchKey, DelayedOperationKey {
private final String groupId;
private final TopicIdPartition topicIdPartition;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TopicIdPartition contains both topicId and name. We just need the former in the key. Ditto for DelayedShareFetchPartitionKey.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree we don't need the name, but we will need the partition number, so I'll add Uuid topicId and int partition to both DelayedShareFetchGroupKey and DelayedShareFetchPartitionKey.

@junrao
Copy link
Contributor

junrao commented Oct 8, 2024

Perform a shutdown of the delayed share fetch purgatory like the others in ReplicaManager
I feel its better we declare the delayed share fetch purgatory inside ReplicaManager along with the existing purgatories. We don't need a reference to this purgatory outside of ReplicaManager, we can just add accessor methods. What do you think?

We can do that too if it makes code simpler.

@adixitconfluent
Copy link
Contributor Author

adixitconfluent commented Oct 9, 2024

Also, there seems to be another existing issue. If a sharePartition is being initialized, any pending shareFetchRequest is blocked in the purgatory. So, after the initialization completes, we need to trigger a check in the share fetch purgatory to wake up pending delayed operations.

Hi @junrao, we are aware about the share partition initialization issues and we have a JIRA for it https://issues.apache.org/jira/browse/KAFKA-17510 , I've added In the description what you mentioned and it should be completed as part of that JIRA

@adixitconfluent
Copy link
Contributor Author

adixitconfluent commented Oct 9, 2024

We can do that too if it makes code simpler.

Thanks @junrao , I've created a JIRA https://issues.apache.org/jira/browse/KAFKA-17742 to address this in my future PRs.

@adixitconfluent adixitconfluent requested a review from junrao October 9, 2024 07:41
@apoorvmittal10
Copy link
Collaborator

Re-opening PR to trigger build.

Copy link
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adixitconfluent : Thanks for the updated PR. LGTM. Waiting for the tests to complete.

@junrao junrao merged commit 8125c3d into apache:trunk Oct 9, 2024
9 of 10 checks passed
tedyu pushed a commit to tedyu/kafka that referenced this pull request Jan 6, 2025
…che#17380)

Move ActionQueue outside DelayedShareFetch class to SharePartitionManager where SharePartitionManager has the ability to add a delayed action to the ActionQueue.

Add TopicPartition as a key for delayed share fetch along with SharePartition (that is already present right now). This will be utilized later when we add the code to know if new data has been added to the topic partition.

Reviewers: Apoorv Mittal <[email protected]>, Jun Rao <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-approved core Kafka Broker KIP-932 Queues for Kafka
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants