-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix][broker] BacklogMessageAge is not reset when cursor mdPosition is on an open ledger #24915
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
0589905 to
990851f
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #24915 +/- ##
=============================================
+ Coverage 38.45% 74.26% +35.81%
- Complexity 13176 33844 +20668
=============================================
Files 1855 1913 +58
Lines 144926 149329 +4403
Branches 16814 17334 +520
=============================================
+ Hits 55735 110905 +55170
+ Misses 81668 29574 -52094
- Partials 7523 8850 +1327
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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
…s on an open ledger (apache#24915) (cherry picked from commit 54da0c8) (cherry picked from commit f97f365)
…s on an open ledger (apache#24915) (cherry picked from commit 54da0c8) (cherry picked from commit 60ea33a)
…s on an open ledger (apache#24915) (cherry picked from commit 54da0c8) (cherry picked from commit 60ea33a)
…s on an open ledger (apache#24915) (cherry picked from commit 54da0c8) (cherry picked from commit f97f365)
…s on an open ledger (apache#24915) (cherry picked from commit 54da0c8)
Motivation
The topic stats have a metric:
oldestBacklogMessageAgeSeconds, which represents the age in seconds of the earliest backlogged message's AgeSeconds in the topic.The broker will periodically check each topic to update these metics, and it decides whether to use a precise check or an estimated check based on the
PreciseTimeBasedBacklogQuotaCheckconfiguration.When
PreciseTimeBasedBacklogQuotaCheck=false, the broker will calculate its age based on the close time of the ledger corresponding to the old position.Because the time can only be obtained when the ledger is closed, if an
oldPositionwas obtained initially, but afterward, the subscription in the topic is always caught up to the currently open ledger, then it will be skipped every time this oldPosition is updated. (The broker's default interval for updating the oldPosition is 60S, and it is very likely to hit this situation on every check.)pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
Lines 3846 to 3855 in 437d9f6
This can be very confusing for users using this metric, as the subscription's MarkDeletePosition is at the latest position, but the
oldestBacklogMessageAgeSecondsmetric keeps increasing.You can run the
backlogsAgeMetricsNoPreciseWithoutBacklogQuotatest in this PR to reproduce this situation.Modifications
When
PreciseTimeBasedBacklogQuotaCheckis false, if the oldPosition is on a ledger that is currently open, we should consider that there is no oldPosition at this time and set it to -1.Verifying this change
backlogsAgeMetricsNoPreciseWithoutBacklogQuotato cover it.Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: