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


##########
be/src/format_v2/table/mongodb_reader.cpp:
##########
@@ -72,8 +80,11 @@ Status acquire_pool(const TMongoScanDesc& d, 
std::shared_ptr<ClientPool>* result
     for (const auto* value : {&d.uri, &d.username, &d.password, 
&d.auth_database}) {
         key += ":" + std::to_string(value->size()) + ":" + *value;
     }
-    key += ":" + std::to_string(d.timeout_ms) + ":" + 
std::to_string(d.connect_timeout_ms) + ":" +
-           std::to_string(d.server_selection_timeout_ms) + ":" +
+    const auto connect_timeout = std::min<int64_t>(d.connect_timeout_ms, 
d.timeout_ms);
+    const auto selection_timeout = 
std::min<int64_t>(d.server_selection_timeout_ms, d.timeout_ms);
+    // Snapshot planning consumes different amounts of each scan's deadline. 
Key the effective
+    // transport caps, not the remaining lifetime, or every scan could bypass 
the shared pool bound.
+    key += ":" + std::to_string(connect_timeout) + ":" + 
std::to_string(selection_timeout) + ":" +

Review Comment:
   [P2] Keep remaining snapshot budgets out of the pool key
   
   `MongoScanPlanProvider.planScan()` now puts each snapshot range's 
`remainingMillis()` into `timeout_ms`. With the default 10000 ms 
connect/selection caps and `query_timeout=2`, ranges planned with 1990 ms and 
1980 ms remaining produce different keys here. Even with 
`mongodb.pool_max_clients=1`, both scanners on the same BE can then lease a 
client from their own pool, bypassing the configured bound; concurrent snapshot 
statements multiply this further. Keep the shared pool identity/bound 
independent of per-scan remaining time and enforce deadlines separately. The 
new `pool_case` uses 1000 ms transport caps, so its 2 s/30 s queries miss this 
below-cap case.



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