Skip to content

add LeafSegmentsBundle to give callers more flexibility for processing segments#18710

Merged
gianm merged 4 commits into
apache:masterfrom
clintropolis:vsf-leaf-segments-bundle
Nov 3, 2025
Merged

add LeafSegmentsBundle to give callers more flexibility for processing segments#18710
gianm merged 4 commits into
apache:masterfrom
clintropolis:vsf-leaf-segments-bundle

Conversation

@clintropolis
Copy link
Copy Markdown
Member

After #18683, in virtual storage mode there are no longer 'missing' segments after the initial timeline operation to obtain the DataSegment objects for the given set of SegmentDescriptor, so we can simplify things in such as way as to both give callers additional flexibility on how they handle loading on demand (not really utilized in this PR).

To model this, a new LeafSegementsBundle has been added that holds the result of partitioning a list of DataSegmentAndDescriptors into:

  • segments which are already loaded in the cache (for which it obtains a SegmentReference to place a hold on them)
  • segments which can be loaded on demand (via virtual storage mode)
  • segments which are not in the cache and not loadable on demand (e.g. there was no DataSegment in the timeline in virtual storage mode, or the segment has been dropped before getCachedSegment could be called in regular mode).

Two new methods has been added to SegmentManager,getSegmentsBundle to build a LeafSegmentsBundle, and canLoadSegmentsOnDemand to indicate that a SegmentCacheManager can support loading a segment on demand if it was not present in the cache already. ServerManager has been transitioned to use these methods, even though it still downloads all 'load on demand' segments up front before building query runners.

This change also lets us streamline the handling of 'missing' segments in ServerManager. (e.g. those which are dropped from a historical after the broker has already picked them and issued a query and are added to the header as a 'missing' segment for the broker to retry). Instead of handling missing segments 'inline' and using a ReportTimelineMissingSegmentQueryRunner, because we are using LeafSegmentsBundle we can just split the handling of these segments out as soon as we make the bundle and directly add them to the missing segments of the response context. ReportTimelineMissingSegmentQueryRunner has been removed, since the only remaining uses

*/
boolean canHandleSegments();

default boolean canLoadSegmentOnDemand(DataSegment segment)

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'segment' is never used.
@gianm gianm merged commit 14f4c40 into apache:master Nov 3, 2025
91 of 92 checks passed
@clintropolis clintropolis deleted the vsf-leaf-segments-bundle branch November 4, 2025 17:33
@kgyrtkirk kgyrtkirk added this to the 36.0.0 milestone Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants