-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[improve][broker]Improve the feature "Optimize subscription seek (cursor reset) by timestamp": search less entries #24219
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
[improve][broker]Improve the feature "Optimize subscription seek (cursor reset) by timestamp": search less entries #24219
Conversation
…sor reset) by timestamp": search less entries
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.
I haven't reviewed this yet, but we might need more real world test cases to get confidence that we don't cause regressions. Previous optimization changes caused regression #23910 which was addressed by #23919. The optimization was different that time, so perhaps things are fine with this optimization.
merlimat
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.
The change looks good. I'm this case it's safe to skip the first ledger in the search since all the entries would have a smaller timestamp. Including last entry is enough.
…sor reset) by timestamp": search less entries (apache#24219) (cherry picked from commit bb2e4ab) (cherry picked from commit 376bf6e)
…sor reset) by timestamp": search less entries (apache#24219) (cherry picked from commit bb2e4ab) (cherry picked from commit 376bf6e)
…sor reset) by timestamp": search less entries (apache#24219) (cherry picked from commit bb2e4ab) (cherry picked from commit e7dece7)
…sor reset) by timestamp": search less entries (apache#24219) (cherry picked from commit bb2e4ab) (cherry picked from commit e7dece7)
…sor reset) by timestamp": search less entries (apache#24219) (cherry picked from commit bb2e4ab)
…sor reset) by timestamp": search less entries (apache#24219) (cherry picked from commit bb2e4ab) (cherry picked from commit e7dece7)
…sor reset) by timestamp": search less entries (apache#24219)
…sor reset) by timestamp": search less entries (apache#24219)
Motivation
Background
#22792 improved the behavior that searching messages by timestamp. For example:
There are ledgers as follows:
[{ "ledger": "1", "entries": "10", "closed_time": "1000" },{ "ledger": "2", "entries": "10", "closed_time": "1010" },{ "ledger": "3", "entries": "10", "closed_time": "3000" }]And the config
broker.conf -> managedLedgerCursorResetLedgerCloseTimestampMaxClockSkewMillisis20ms, when you search for timestamp1000, the broker will find ledgers whose timestamp is larger thanledger.closed_time-20and less thanledger.closed_time+20. Then the result range is[1:0 ~ 3:9].Modifications
Since we have the configuration
broker.conf -> managedLedgerCursorResetLedgerCloseTimestampMaxClockSkewMillis, the entries[1:0 ~ 1:8]can be skipped to search, because we have already given enough scope expanded bymanagedLedgerCursorResetLedgerCloseTimestampMaxClockSkewMillis, which improves the search.Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: x