xiangfu0 commented on code in PR #20280:
URL: https://github.com/apache/pinot/pull/20280#discussion_r4593046484
##########
pinot-timeseries/pinot-timeseries-planner/src/main/java/org/apache/pinot/tsdb/planner/physical/TableScanVisitor.java:
##########
@@ -67,18 +71,68 @@ public void assignSegmentsToPlan(BaseTimeSeriesPlanNode
planNode, TimeBuckets ti
compileBrokerRequest(sfpNode.getTableName(), filterExpression),
context._requestId);
Preconditions.checkNotNull(routingTable, "Failed to get routing table
for table: " + sfpNode.getTableName());
+ routingTable = context._routingCustomizer.customize(sfpNode,
routingTable, context._routingContext);
+ Preconditions.checkNotNull(routingTable, "Routing customizer returned no
routing for table: "
+ + sfpNode.getTableName());
+ List<String> unavailableSegments = routingTable.getUnavailableSegments();
+ if (routingTable.getServerInstanceToSegmentsMap().isEmpty() &&
unavailableSegments != null
+ && !unavailableSegments.isEmpty()) {
+ // No data in range is an empty result; segments no server can serve
are an outage, not an empty result.
+ throw new QueryException(QueryErrorCode.SERVER_SEGMENT_MISSING,
String.format(
+ "No server can serve %d unavailable segment(s) of table: %s",
unavailableSegments.size(),
+ sfpNode.getTableName()));
+ }
for (var entry :
routingTable.getServerInstanceToSegmentsMap().entrySet()) {
ServerInstance serverInstance = entry.getKey();
- List<String> segments = entry.getValue().getSegments();
+ List<String> segments = entry.getValue().getSegments() == null ?
List.of() : entry.getValue().getSegments();
+ List<String> optionalSegments = entry.getValue().getOptionalSegments()
== null ? List.of()
Review Comment:
**Critical — The default router drops optional-only assignments before
planning.** `BaseBrokerRoutingManager` discards servers with zero required
segments. If the only matching segment is already loaded and the external view
still lags, the new zero-server path can return a successful empty result where
the old planner reported an error. The new planner test mocks the assignment
that production drops. Add a time-series routing option that preserves these
assignments and test it through the routing manager.
##########
pinot-timeseries/pinot-timeseries-planner/src/main/java/org/apache/pinot/tsdb/planner/physical/TimeSeriesDispatchablePlan.java:
##########
@@ -69,8 +76,22 @@ public List<BaseTimeSeriesPlanNode> getServerFragments() {
return _serverFragments;
}
- public List<String> getSerializedServerFragments() {
- return _serializedServerFragments;
+ /// The serialized fragments a server runs: all of them when one server runs
the whole plan, else the fragments of
+ /// the leaves it holds segments for. A server sends one block per fragment
it runs, and each exchange waits for one
+ /// block from each server holding its leaf, so a server that ran a leaf it
holds no segments for would send an extra
+ /// block that the exchange could take in place of a server's real data.
+ public List<String> getSerializedServerFragments(String instanceId) {
+ if (_queryServerInstances.size() == 1) {
Review Comment:
**Critical — Single-server plans still execute leaves with no routed
segments.** If a custom planner emits two leaves and only one routes to server
S, the fast path sends both leaves to S. The unrouted leaf can fail with
`SERVER_TABLE_MISSING` if S doesn’t host its table. On an upsert table, it can
also read newly added segments despite the customizer selecting none. Use
full-plan pushdown only when every leaf routes to the sole server. Cover the
one-server case alongside the existing two-server test.
##########
pinot-timeseries/pinot-timeseries-planner/src/main/java/org/apache/pinot/tsdb/planner/physical/TableScanVisitor.java:
##########
@@ -67,18 +71,68 @@ public void assignSegmentsToPlan(BaseTimeSeriesPlanNode
planNode, TimeBuckets ti
compileBrokerRequest(sfpNode.getTableName(), filterExpression),
context._requestId);
Preconditions.checkNotNull(routingTable, "Failed to get routing table
for table: " + sfpNode.getTableName());
+ routingTable = context._routingCustomizer.customize(sfpNode,
routingTable, context._routingContext);
+ Preconditions.checkNotNull(routingTable, "Routing customizer returned no
routing for table: "
+ + sfpNode.getTableName());
+ List<String> unavailableSegments = routingTable.getUnavailableSegments();
+ if (routingTable.getServerInstanceToSegmentsMap().isEmpty() &&
unavailableSegments != null
Review Comment:
**Major — Empty server entries bypass `SERVER_SEGMENT_MISSING`.** A
customizer can retain server keys and unavailable segments while clearing both
segment lists. The map passes the availability check, then the loop skips every
entry and the leaf returns empty. Check for unavailable segments after
discarding empty assignments.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]