HappenLee commented on code in PR #67762:
URL: https://github.com/apache/doris/pull/67762#discussion_r4023171206


##########
be/src/exec/rowid_fetcher.cpp:
##########
@@ -317,31 +323,47 @@ Status RowIdStorageReader::read_by_rowids(const 
PMultiGetRequestV2& request,
     return Status::OK();
 }
 
+Status RowIdStorageReader::read_internal_segment_groups(
+        size_t group_count, int batch_groups, int concurrency, bool 
fetch_row_store,
+        const std::function<Status(size_t, size_t)>& read_groups) {
+    if (group_count == 0) {
+        return Status::OK();
+    }
+    auto read_range = [&](size_t begin, size_t end) -> Status {
+        Status status;
+        // A thrown exception must not escape bthread_fork_join: it would skip 
completion
+        // accounting and leave the RPC waiting for a task that can never 
finish.
+        try {
+            ASSIGN_STATUS_IF_CATCH_EXCEPTION(status = read_groups(begin, end), 
status);
+        } catch (const std::exception& e) {
+            status = Status::InternalError("Row id fetch failed because {}", 
e.what());
+        }
+        return status;
+    };
+    if (fetch_row_store || batch_groups <= 0 || concurrency <= 1 ||
+        std::cmp_less_equal(group_count, batch_groups)) {
+        return read_range(0, group_count);
+    }
+    const auto groups_per_task = static_cast<size_t>(batch_groups);
+    std::vector<std::function<Status()>> tasks;
+    tasks.reserve(1 + (group_count - 1) / groups_per_task);
+    for (size_t begin = 0; begin < group_count; begin += groups_per_task) {
+        tasks.emplace_back([&, begin] {

Review Comment:
   The exception-safety gap is in the shared Doris helper 
cloud::bthread_fork_join(), which is also used by other call sites. We will 
leave changes to that common code out of this PR and address them consistently 
in a separate follow-up PR, including validation of the existing callers.



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