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

[fix][broker] Added the skipped message handler for ServiceUnitStateChannel #20677

Merged
merged 1 commit into from
Jun 30, 2023

Conversation

heesung-sn
Copy link
Contributor

Motivation

When topic lookups race(and the first lookup returns too fast before the second request gets deduped), the later lookup requests can timeout because the skipped messages are ignored at the table view and do not notify the service unit state channel.

ex:

m1: assign to b1 -> m2: owned by b1 -> m3: assign to b2 // m3 is skipped at the tableview

When m3 is skipped, we better get the channel notified to return the lookup request with the current owner(b1) instead of letting the request time out.

Modifications

  • Added the handleSkippedMessage and setSkippedMsgHandler in TopicCompactionStrategy.
  • ServiceUnitStateChannel registers ServiceUnitStateChannel.handleSkippedEvent to ServiceUnitStateCompactionStrategy by setSkippedMsgHandler.
  • TableView calls TopicCompactionStrategy.handleSkippedMessage when messages are skipped.

Verifying this change

This change is already covered by existing tests, such as ServiceUnitStateChannelImpl.conflictAndCompactionTest

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: heesung-sn#48

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jun 29, 2023
Copy link
Member

@Demogorgon314 Demogorgon314 left a comment

Choose a reason for hiding this comment

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

This change LGTM, but I think this is a temporary solution. We should refactor in the future.

@heesung-sn
Copy link
Contributor Author

This change LGTM, but I think this is a temporary solution. We should refactor it in the future.

The cleaner approach would be to expose listenSkipedMessage(..) on TableView or register the TopicCompactionStrategy instance to the TableView. However, since this msg skip concept has not been exposed now, I implemented this in this way. We can refactor this part when the community wants to expose TopicCompactionStrategy to users.

@Demogorgon314 Demogorgon314 merged commit 8d6b931 into apache:master Jun 30, 2023
47 checks passed
Technoboy- pushed a commit that referenced this pull request Jul 3, 2023
…hannel (#20677)

### Motivation

When topic lookups race(and the first lookup returns too fast before the second request gets deduped), the later lookup requests can timeout because the skipped messages are ignored at the table view and do not notify the service unit state channel.

ex:

m1: assign to b1 -> m2: owned by b1 -> m3: assign to b2 // m3 is skipped at the tableview

When m3 is skipped, we better get the channel notified to return the lookup request with the current owner(b1) instead of letting the request time out.

### Modifications

- Added the `handleSkippedMessage` and `setSkippedMsgHandler` in `TopicCompactionStrategy`. 
- `ServiceUnitStateChannel` registers `ServiceUnitStateChannel.handleSkippedEvent` to `ServiceUnitStateCompactionStrategy` by `setSkippedMsgHandler`.
- TableView calls `TopicCompactionStrategy.handleSkippedMessage` when messages are skipped.
}


static TopicCompactionStrategy load(String tag, String topicCompactionStrategyClassName) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should not cherry-pick this public API change to branch-3.0 @Technoboy-

Copy link
Member

Choose a reason for hiding this comment

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

This API should only use for extensible load managers. I added an annotation to mark this as private, #20858 , please help take a look at this PR.

@heesung-sn heesung-sn deleted the skiped-msg-handler branch April 2, 2024 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants