Repository navigation
Support optional segments in the multi-stage query engine - #20313
Jackie-Jiang wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #20313 +/- ##
=============================================
- Coverage 71.47% 61.23% -10.24%
+ Complexity 1639 1 -1638
=============================================
Files 3615 2793 -822
Lines 244521 180605 -63916
Branches 39767 30252 -9515
=============================================
- Hits 174764 110602 -64162
- Misses 56572 60664 +4092
+ Partials 13185 9339 -3846
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
yashmayya
left a comment
There was a problem hiding this comment.
@Jackie-Jiang, I have two questions on the replicated leaf. The description covers both behaviors. I ask because the result changes with no error.
1. New broker with old servers. Today a new segment is a required segment on this leaf, and a server that loaded it scans it. After this change, an old server ignores the optional segments. Thus an old server skips the segment, also when it loaded the segment. A query that returns these rows today loses them during a rolling upgrade. Is a broker config necessary to gate this, as for the proto segment list?
2. Same version on all nodes. A worker whose server did not load the new segment joins without its rows. An inner join then drops the matching rows of the other table on that worker only. A lineage swap looks like the worst case: the old segments leave the selection when the new segments enter it. Is a partial join with no error acceptable for is_replicated tables, or is a failure better here?
7483f3f to
c0a16ef
Compare
|
@yashmayya, thanks. Both are addressed in the latest push. 1. New broker with old servers. Agreed, that loses rows a query returns today. The replicated leaf is now gated by a broker config, 2. Same version on all nodes. With the config off, a server that has not loaded a new segment fails the query, as today. With it on, the partial join is possible, but it is now bounded: |
An optional segment is a new segment the broker has not seen online on a server yet. The server queries it if it has loaded it, and skips it without failing the query otherwise. The single-stage engine has routed them since PR apache#11978. The multi-stage engine dropped them, so new data stayed invisible until the external view caught up, and a replicated table failed the query on a new segment a server had not loaded yet. The segments of a leaf worker are now carried as a SegmentsToQuery, the pair of segments and optional segments the routing table already returns, from routing through the planner and the wire to the server: - Non-partitioned leaves, logical tables and the physical optimizer pass on the pair the routing table gives each server - Partitioned leaves get the new segments a partition leaves out of its fully replicated segments as the optional segments of the worker of the partition - Replicated leaves ask the instance selector which segments are new and not online on every server, through RoutingManager#getSegmentsToQuery, which replaces getSegments. They send these segments as optional only when the broker config pinot.broker.mse.enable.replicated.leaf.optional.segments is set, and as regular segments otherwise, as before. The config is off by default, because a server that predates this change skips an optional segment even when it has loaded it. A segment stops being optional once the new segment expiration time has passed since its creation - The proto segment list gets an optionalSegment field, and the legacy JSON encoding an optionalSegmentsMap custom property. A server that predates them ignores either one and keeps skipping these segments
c0a16ef to
26655f1
Compare
Summary
An optional segment is a new segment the broker has not seen online on a server yet. The server queries it if it has loaded it, and skips it without failing the query otherwise. The single-stage engine has routed optional segments since #11978. The multi-stage engine dropped them, so new data stayed invisible until the external view caught up, and a query on a replicated table failed when a server had not loaded a new segment yet.
The segments of a leaf worker are now carried as a
SegmentsToQuery, the pair of segments and optional segments the routing table already returns, from routing through the planner and the wire to the server. No layer converts it back to a plain list, so an extension point such asWorkerManager#filterLeafStageSegmentscannot drop the optional segments by accident.Each kind of leaf gets its optional segments from where it already gets its segments:
SegmentPartitionMetadataManagerpublishes them as the optional segments of the partition, and the worker of the partition queries them.RoutingManager#getSegmentsToQuery. They send these segments as optional only when the new broker config below is set. Every worker queries the other segments as before.New broker config
pinot.broker.mse.enable.replicated.leaf.optional.segments, defaultfalse:Wire format and compatibility
optionalSegmentfield.optionalSegmentsMapcustom property, because older servers parse the existing properties as maps of segment lists.Behavior changes
pinot.broker.new.segment.expiration.seconds, 5 minutes by default) after the segment is created. After that the segment is required again, also when the assignment of the table has not changed since. A table whose segments are all optional is still queried, which relies on Do not fail the query when the server has not set up the table and all segments are optional #20262 when a server has not set up the table yet.NON_ACTIVE_WORKERSno longer counts a worker that only has optional segments.RoutingManager#getSegmentsis removed. The replicated leaf was its only caller, andgetSegmentsToQueryreplaces it.SegmentsToQuerytreats anulllist of optional segments as an empty list.Not covered
Earlier takes on this: #19144, #19537, #20017.
🤖 Generated with Claude Code