Gabriel39 commented on code in PR #70708:
URL: https://github.com/apache/doris/pull/70708#discussion_r4662381252


##########
be/src/format_v2/table/mongodb_reader.cpp:
##########
@@ -220,16 +261,29 @@ class NativeMongoStream final : public MongoCursorStream {
 public:
     ~NativeMongoStream() override { close(); }
     Status open(const TMongoScanDesc& d, std::function<bool()> cancelled) 
override {
-        _cancelled = std::move(cancelled);
-        _deadline = Clock::now() + std::chrono::milliseconds(d.timeout_ms);
+        if (_client) {
+            return Status::InvalidArgument("MongoDB stream requires close 
before reopening");
+        }
+        if (!_pool) {
+            _cancelled = std::move(cancelled);
+            _deadline = Clock::now() + std::chrono::milliseconds(d.timeout_ms);
+            RETURN_IF_ERROR(check_deadline());
+            RETURN_IF_ERROR(validate_pushdown_bson(d));
+            RETURN_IF_ERROR(validate_snapshot_descriptor(d));
+            RETURN_IF_ERROR(acquire_pool(d, &_pool));
+        }
+        // Preserve the first deadline across cooperative retries. Sleeping 
here can occupy a
+        // workload group's only scanner worker while the client holder is 
queued to resume.
         RETURN_IF_ERROR(check_deadline());
-        RETURN_IF_ERROR(validate_pushdown_bson(d));
-        RETURN_IF_ERROR(validate_snapshot_descriptor(d));
-        RETURN_IF_ERROR(acquire_pool(d, &_pool));
-        while (!(_client = mongoc_client_pool_try_pop(_pool->pool.get()))) {
+        _client = mongoc_client_pool_try_pop(_pool->pool.get());

Review Comment:
   Follow-up superseding the PipelineTask startup-gate explanation in my 
earlier reply: 4a5e8c2669da9fa8c3bfddf5a6e4e8affce8ec7b removed that approach 
entirely. Both pipeline files now match the PR merge base exactly; this PR no 
longer adds pre-open dependency extraction or refreshes dependencies a second 
time.
   
   The current solution isolates native client admission by query ID, fragment 
instance ID and scan output tuple, in addition to 
catalog/configuration/authentication/transport identity. Probe/build inputs and 
independent scan instances therefore cannot exhaust each other's quota. Splits 
within one instance still share the configured bound and retry cooperatively 
with their original deadline. This also means aggregate client capacity can 
increase with active scan instances, as documented.
   
   The final pool-scope implementation passed 111 related ASAN 
reader/native-stream, ScannerContext and PipelineTask tests, including 
actual-libmongoc independent-admission tests that failed with the old shared 
key. The eight-case live run quoted in my earlier reply qualified the former 
startup gate; it does not qualify the replacement pool scope. The retained 
join/fault oracles were updated, but the live scan-isolation matrix and 
connection-overhead measurements have not been rerun. The original generic 
dependency lifecycle is preserved.



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