github-actions[bot] commented on code in PR #25796: URL: https://github.com/apache/doris/pull/25796#discussion_r1382661621
########## be/src/runtime/load_stream_writer.cpp: ########## @@ -121,7 +121,15 @@ Status LoadStreamWriter::close_segment(uint32_t segid) { return Status::OK(); } -Status LoadStreamWriter::add_segment(uint32_t segid, SegmentStatistics& stat) { +Status LoadStreamWriter::add_segment(uint32_t segid, const SegmentStatistics& stat) { Review Comment: warning: method 'add_segment' can be made static [readability-convert-member-functions-to-static] be/src/runtime/load_stream_writer.h:73: ```diff - Status add_segment(uint32_t segid, const SegmentStatistics& stat); + static Status add_segment(uint32_t segid, const SegmentStatistics& stat); ``` ########## be/src/vec/sink/load_stream_stub.cpp: ########## @@ -83,31 +83,33 @@ void LoadStreamStub::LoadStreamReplyHandler::on_closed(brpc::StreamId id) { _close_cv.notify_all(); } -LoadStreamStub::LoadStreamStub(PUniqueId load_id, int64_t src_id) - : _load_id(load_id), +LoadStreamStub::LoadStreamStub(PUniqueId load_id, int64_t src_id, int num_use) + : _use_cnt(num_use), + _load_id(load_id), _src_id(src_id), _tablet_schema_for_index(std::make_shared<IndexToTabletSchema>()), - _enable_unique_mow_for_index(std::make_shared<IndexToEnableMoW>()) {}; + _enable_unique_mow_for_index(std::make_shared<IndexToEnableMoW>()) {} LoadStreamStub::LoadStreamStub(LoadStreamStub& stub) - : _load_id(stub._load_id), + : _use_cnt(stub._use_cnt.load()), + _load_id(stub._load_id), _src_id(stub._src_id), _tablet_schema_for_index(stub._tablet_schema_for_index), - _enable_unique_mow_for_index(stub._enable_unique_mow_for_index) {}; + _enable_unique_mow_for_index(stub._enable_unique_mow_for_index) {} LoadStreamStub::~LoadStreamStub() { if (_is_init.load() && !_handler.is_closed()) { brpc::StreamClose(_stream_id); + static_cast<void>(close_wait(60000)); // 60s Review Comment: warning: 60000 is a magic number; consider replacing it with a named constant [readability-magic-numbers] ```cpp static_cast<void>(close_wait(60000)); // 60s ^ ``` ########## be/src/vec/sink/vtablet_sink_v2.cpp: ########## @@ -165,35 +175,37 @@ 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())); - + RETURN_IF_ERROR(_open_streams()); 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) { + _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() { Review Comment: warning: method '_open_streams' can be made static [readability-convert-member-functions-to-static] be/src/vec/sink/vtablet_sink_v2.h:125: ```diff - Status _open_streams(); + static Status _open_streams(); ``` ########## be/src/vec/sink/vtablet_sink_v2.cpp: ########## @@ -165,35 +175,37 @@ 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())); - + RETURN_IF_ERROR(_open_streams()); return Status::OK(); } -Status VOlapTableSinkV2::_open_streams(int64_t src_id) { +Status VOlapTableSinkV2::_init_streams(int64_t src_id) { Review Comment: warning: method '_init_streams' can be made static [readability-convert-member-functions-to-static] be/src/vec/sink/vtablet_sink_v2.h:123: ```diff - Status _init_streams(int64_t src_id); + static Status _init_streams(int64_t src_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