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


##########
be/src/vec/sink/vtablet_sink_v2.cpp:
##########
@@ -210,36 +221,44 @@ Status VOlapTableSinkV2::open(RuntimeState* state) {
     SCOPED_CONSUME_MEM_TRACKER(_mem_tracker.get());
     signal::set_signal_task_id(_load_id);
 
-    _build_tablet_node_mapping();
-    RETURN_IF_ERROR(_open_streams(state->backend_id()));
-    _init_row_distribution();
+    RETURN_IF_ERROR(_open_streams());
+    RETURN_IF_ERROR(_init_row_distribution());
 
     return Status::OK();
 }
 
-Status VOlapTableSinkV2::_open_streams(int64_t src_id) {
+Status VOlapTableSinkV2::_init_streams(int64_t src_id) {
     for (auto& [dst_id, _] : _tablets_for_node) {
-        auto node_info = _nodes_info->find_node(dst_id);
-        if (node_info == nullptr) {
-            return Status::InternalError("Unknown node {} in tablet location", 
dst_id);
-        }
-        std::shared_ptr<Streams> streams;
-        streams = 
ExecEnv::GetInstance()->load_stream_stub_pool()->get_or_create(
-                _load_id, src_id, dst_id, _stream_per_node);
-        // get tablet schema from each backend only in the 1st stream
-        for (auto& stream : *streams | std::ranges::views::take(1)) {
-            const std::vector<PTabletID>& tablets_for_schema = 
_indexes_from_node[node_info->id];
-            
RETURN_IF_ERROR(stream->open(_state->exec_env()->brpc_internal_client_cache(),
-                                         *node_info, _txn_id, *_schema, 
tablets_for_schema,
-                                         _total_streams, 
_state->enable_profile()));
-        }
-        // for the rest streams, open without getting tablet schema
-        for (auto& stream : *streams | std::ranges::views::drop(1)) {
-            
RETURN_IF_ERROR(stream->open(_state->exec_env()->brpc_internal_client_cache(),
-                                         *node_info, _txn_id, *_schema, {}, 
_total_streams,
-                                         _state->enable_profile()));
-        }
-        _streams_for_node[dst_id] = streams;
+        _streams_for_node[dst_id] = 
ExecEnv::GetInstance()->load_stream_stub_pool()->get_or_create(
+                _load_id, src_id, dst_id, _stream_per_node, _num_local_sink);
+    }
+    return Status::OK();
+}
+
+Status VOlapTableSinkV2::_open_streams() {
+    for (auto& [dst_id, streams] : _streams_for_node) {
+        RETURN_IF_ERROR(_open_streams_to_backend(dst_id, *streams));
+    }
+    return Status::OK();
+}
+
+Status VOlapTableSinkV2::_open_streams_to_backend(int64_t dst_id, 
::doris::stream_load::LoadStreams& streams) {
+    auto node_info = _nodes_info->find_node(dst_id);

Review Comment:
   warning: 'auto node_info' can be declared as 'const auto *node_info' 
[readability-qualified-auto]
   
   ```suggestion
       const auto *node_info = _nodes_info->find_node(dst_id);
   ```
   



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to