Skip to content

Conversation

@poorbarcode
Copy link
Contributor

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 -> managedLedgerCursorResetLedgerCloseTimestampMaxClockSkewMillis is 20ms, when you search for timestamp 1000, the broker will find ledgers whose timestamp is larger than ledger.closed_time-20 and less than ledger.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 by managedLedgerCursorResetLedgerCloseTimestampMaxClockSkewMillis, which improves the search.

Documentation

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

Matching PR in forked repository

PR in forked repository: x

…sor reset) by timestamp": search less entries
@poorbarcode poorbarcode added this to the 4.1.0 milestone Apr 26, 2025
@poorbarcode poorbarcode self-assigned this Apr 26, 2025
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Apr 26, 2025
Copy link
Member

@lhotari lhotari left a 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.

Copy link
Contributor

@merlimat merlimat left a 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.

@poorbarcode poorbarcode merged commit bb2e4ab into apache:master Apr 27, 2025
52 checks passed
lhotari pushed a commit that referenced this pull request Apr 28, 2025
…sor reset) by timestamp": search less entries (#24219)

(cherry picked from commit bb2e4ab)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request May 2, 2025
…sor reset) by timestamp": search less entries (apache#24219)

(cherry picked from commit bb2e4ab)
(cherry picked from commit 376bf6e)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request May 6, 2025
…sor reset) by timestamp": search less entries (apache#24219)

(cherry picked from commit bb2e4ab)
(cherry picked from commit 376bf6e)
poorbarcode added a commit that referenced this pull request May 7, 2025
…sor reset) by timestamp": search less entries (#24219)

(cherry picked from commit bb2e4ab)
poorbarcode added a commit that referenced this pull request May 7, 2025
…sor reset) by timestamp": search less entries (#24219)

(cherry picked from commit bb2e4ab)
@poorbarcode
Copy link
Contributor Author

manas-ctds pushed a commit to datastax/pulsar that referenced this pull request May 7, 2025
…sor reset) by timestamp": search less entries (apache#24219)

(cherry picked from commit bb2e4ab)
(cherry picked from commit e7dece7)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request May 7, 2025
…sor reset) by timestamp": search less entries (apache#24219)

(cherry picked from commit bb2e4ab)
(cherry picked from commit e7dece7)
dao-jun pushed a commit to ascentstream/pulsar that referenced this pull request May 8, 2025
…sor reset) by timestamp": search less entries (apache#24219)

(cherry picked from commit bb2e4ab)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request May 12, 2025
…sor reset) by timestamp": search less entries (apache#24219)

(cherry picked from commit bb2e4ab)
(cherry picked from commit e7dece7)
KannarFr pushed a commit to CleverCloud/pulsar that referenced this pull request Sep 22, 2025
walkinggo pushed a commit to walkinggo/pulsar that referenced this pull request Oct 8, 2025
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.

4 participants