Multi-stage leaf routing: optional segments, unavailable metadata, and empty partitions#18390
Multi-stage leaf routing: optional segments, unavailable metadata, and empty partitions#18390rsrkpatwari1234 wants to merge 9 commits intoapache:masterfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #18390 +/- ##
============================================
- Coverage 63.48% 63.43% -0.05%
Complexity 1701 1701
============================================
Files 3254 3254
Lines 199114 199281 +167
Branches 30833 30875 +42
============================================
+ Hits 126399 126418 +19
- Misses 62643 62770 +127
- Partials 10072 10093 +21
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
xiangfu0
left a comment
There was a problem hiding this comment.
Found one high-signal issue; see inline comment.
| private void assignNonPartitionedLeafWorkersWhenNoServersHaveSegments(DispatchablePlanMetadata metadata, | ||
| String tableName, Map<String, RoutingTable> routingTableMap, DispatchablePlanContext context, | ||
| @Nullable TimeBoundaryInfo timeBoundaryInfo) { | ||
| Map<String, ServerInstance> routableServers = _routingManager.getRoutableServerInstanceMap(); |
There was a problem hiding this comment.
This empty-routing fallback is pulling from the global routable-server pool instead of a table-scoped candidate set. On a multi-tenant cluster that can place an empty-table leaf on a server that does not host this table, and the leaf then fails in constructServerQueryRequests() when instanceDataManager.getTableDataManager(table) returns null. The fallback needs to stay within servers that actually serve the table; the same global-pool issue also shows up again in the empty-partition fallbacks below.
Fixes #18223
Summary
Multi-stage query planning used to ignore or mishandle a few real-world routing situations: optional segments (segments the broker may still send so servers can decide what to do), unavailable segments (known missing pieces of the table), partitions with no data, and workers that end up with no segments at all.
What changed
The planner now carries optional segments per worker, records unavailable segments in metadata when routing provides them, and handles empty partitions and empty routing by assigning a worker with empty segment lists instead of failing. Dispatch sends optional segments on leaf requests, and the leaf operator forwards empty results that still have a schema so later stages stay consistent.
Test Plan
Added unit tests