github-actions[bot] commented on code in PR #70708:
URL: https://github.com/apache/doris/pull/70708#discussion_r4661855555


##########
fe/fe-connector/fe-connector-mongodb/src/main/java/org/apache/doris/connector/mongodb/MongoSnapshot.java:
##########
@@ -41,6 +42,7 @@ final class MongoSnapshot {
     static TMongoSnapshot prepare(ConnectorSession session, 
MongoCatalogProperties properties,
             MongoTableHandle table, Supplier<MongoCatalogClient> client, 
String concern,
             String preference, long timeoutMs) {

Review Comment:
   [P2] Stop snapshot selection when the split assignment is cancelled
   
   `planScan` passes `request.getScanContext()` only to the checks around 
`MongoSnapshot.prepare`; `prepare`/`State.pin` then perform `snapshotSource` 
and `selectSnapshot` without that context. When `SplitAssignment.stop()` 
handles a producer/source failure it cancels this context immediately, but the 
task schedulers can remain open, so a synchronous snapshot selection already in 
flight keeps running and can issue further FE source work until 
`query_timeout`. Thread the scan cancellation callback/context through snapshot 
preparation and check it around each blocking selection operation so a stopped 
split producer unwinds promptly.



##########
fe/fe-connector/fe-connector-mongodb/src/main/java/org/apache/doris/connector/mongodb/MongoScanPlanProvider.java:
##########
@@ -109,8 +127,113 @@ public List<ConnectorScanRange> planScan(ConnectorSession 
session, ConnectorScan
             // Include complete source roots so pruning cannot turn malformed 
nested paths into missing values.
             d.setProjectionBson(encode(projection));
         }
-        // One cursor owns the entire logical namespace. Filters and LIMIT 
remain Doris residuals.
-        return List.of(new MongoScanRange(d));
+        // A scan node owns this provider and admits its final request once. 
Properties loading
+        // must not freeze a smaller pre-filter reservation that later rejects 
a legitimate query.
+        long descriptorSize = descriptorBytes(session, handle, d);
+        MongoSplitPlan plan = rangePlanner.plan(session, handle, snapshot, 
d.getReadPreference(),
+                request.getScanContext(), descriptorSize);
+        // Properties can be cached before WHERE and projection are attached. 
Publish diagnostics
+        // from the same final request as the descriptor, without probing 
again during EXPLAIN.
+        rangePlanner.freezeDiagnostics(session, handle, 
Map.of("predicate_pushdown", predicate.kind().name(),
+                "projection_pushdown", 
Boolean.toString(d.isSetProjectionBson())));
+        // Retain the shared descriptor once; streaming creates owned RPC 
values under engine backpressure.
+        // A wide schema must not be copied 256 times merely to keep a frozen 
boundary table in FE.
+        return new AbstractList<>() {
+            @Override
+            public ConnectorScanRange get(int index) {
+                java.util.Objects.checkIndex(index, plan.size());
+                MongoRangePlanner.checkCancelled(session, 
request.getScanContext());
+                TMongoScanDesc range = d.deepCopy();
+                TMongoSplit split = new TMongoSplit();
+                split.setStrategy(plan.family().isEmpty() ? "single" : 
"range");
+                split.setField(plan.field());
+                split.setTypeFamily(plan.family());
+                split.setIndex(index);
+                split.setRequested(plan.requested());
+                split.setAdmitted(plan.admitted());
+                split.setActual(plan.size());
+                split.setReason(plan.reason());

Review Comment:
   [P1] Gate version-2 Mongo range descriptors during rolling upgrades
   
   `planScan` now sets `range.version=2` and attaches `TMongoSplit` for every 
opted-in range plan, but it never checks the selected BE execution capability. 
The base/older `mongodb_reader.cpp` accepts only `d.version == 1` and has no 
field 26, so a new FE scheduling an `auto`/`range` scan to an older BE rejects 
the range as an invalid descriptor instead of falling back to the version-1 
single scan. Please gate publication on `ConnectorSession.getBeExecVersion()` 
(or add an equivalent compatibility path) and retain a safe v1 fallback until 
every target BE understands the new descriptor.



-- 
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]

Reply via email to