platoneko commented on code in PR #18874: URL: https://github.com/apache/doris/pull/18874#discussion_r1185882286
########## be/src/runtime/tablets_channel.cpp: ########## @@ -107,12 +107,26 @@ Status TabletsChannel::open(const PTabletWriterOpenRequest& request) { _next_seqs.resize(_num_remaining_senders, 0); _closed_senders.Reset(_num_remaining_senders); - RETURN_IF_ERROR(_open_all_writers(request)); - + if (!config::enable_lazy_open_partition) { + RETURN_IF_ERROR(_open_all_writers(request)); + } else { + _build_partition_tablets_relation(request); + } _state = kOpened; return Status::OK(); } +void TabletsChannel::_build_partition_tablets_relation(const PTabletWriterOpenRequest& request) { + for (auto& tablet : request.tablets()) { + if (_partition_tablets_map.find(tablet.partition_id()) == _partition_tablets_map.end()) { Review Comment: Can directly use `_partition_tablets_map[partition_id]` here, since `std::map::operator[]` inserts value_type(key, T()) if the key does not exist, according to https://en.cppreference.com/w/cpp/container/map/operator_at -- 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