Skip to content

[Backport] [38.0.0] perf: Interval tree for managing segment metadata in memory - #19851

Merged
kfaraz merged 1 commit into
38.0.0from
backport-452b15b2662136459b2289d08b6eb89232d27c18-to-38.0.0
Aug 2, 2026
Merged

[Backport] [38.0.0] perf: Interval tree for managing segment metadata in memory#19851
kfaraz merged 1 commit into
38.0.0from
backport-452b15b2662136459b2289d08b6eb89232d27c18-to-38.0.0

Conversation

@github-actions

@github-actions github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

{
"backport_issue": "19850",
"message": "Backport for #19850"
}

Segment metadata stored in memory of the Historicals, is used when looking up segments
that match an interval for query and segment loading purposes. Currently this is a serial scan
that goes through all segments metadata in ascending start time order to find matching segments.

This changes introduces an Interval Tree as a more efficient way to store segment metadata in
memory, to speed up searches for segments, and cut down search times from O(n) to O(logn).

Changes:
- Add IntervalTreeMap
- Add SegmentTimelineConfig to enable fastIntervalSearch
- Update SegmentManager and VersionedIntervalTimeline to use IntervalTreeMap when enabled
- Add tests

(cherry picked from commit 452b15b)
@kfaraz
kfaraz merged commit 5edbf7f into 38.0.0 Aug 2, 2026
33 checks passed
@kfaraz
kfaraz deleted the backport-452b15b2662136459b2289d08b6eb89232d27c18-to-38.0.0 branch August 2, 2026 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants