-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[improve][broker] Extract duplication in AbstractTopic#incrementTopicEpochIfNeeded #24520
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
Conversation
lhotari
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you @3pacccccc
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #24520 +/- ##
============================================
+ Coverage 73.57% 74.28% +0.71%
+ Complexity 32624 32481 -143
============================================
Files 1877 1868 -9
Lines 139502 145909 +6407
Branches 15299 16728 +1429
============================================
+ Hits 102638 108389 +5751
- Misses 28908 28918 +10
- Partials 7956 8602 +646
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…EpochIfNeeded (apache#24520) (cherry picked from commit 395b55c)
…EpochIfNeeded (apache#24520) (cherry picked from commit 395b55c)
Motivation
The method AbstractTopic#incrementTopicEpochIfNeeded contains significant code duplication, especially for handling producers in different modes (
Exclusive,ExclusiveWithFencing, andWaitForExclusive). This duplication makes the method overly long, harder to read, and more difficult to maintain. The goal of this PR is to improve code readability and maintainability by extracting the duplicated logic into a separate method.Modifications
Extracted the common logic for handling topic epoch updates and exclusive producer checks into a new method
handleTopicEpochForExclusiveProducer.Replaced the duplicated code blocks in the
Exclusive,ExclusiveWithFencing, andWaitForExclusivecases with calls to the new method.Verifying this change
If the box was checked, please highlight the changes
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: 3pacccccc#14