mymeiyi commented on code in PR #27726: URL: https://github.com/apache/doris/pull/27726#discussion_r1425111937
########## be/src/vec/sink/group_commit_block_sink.cpp: ########## @@ -200,9 +200,31 @@ Status GroupCommitBlockSink::_add_blocks() { load_id.__set_lo(_load_id.lo); if (_load_block_queue == nullptr) { if (_state->exec_env()->wal_mgr()->is_running()) { + std::string wal_dir; + auto* wal_mgr = ExecEnv::GetInstance()->wal_mgr(); + { + std::unique_lock l(lock); + auto map = wal_mgr->get_wal_dir_to_disk_usage_map(); + wal_dir = map.size() == 1 + ? map.begin()->first + : std::max_element(map.begin(), map.end(), + [](const auto& pair1, const auto& pair2) { + return pair1.second->load() < + pair2.second->load(); + }) + ->first; + while (map.at(wal_dir)->load() > + wal_mgr->get_wal_dir_to_max_limit_map().at(wal_dir)) { + ExecEnv::GetInstance()->group_commit_mgr()->cv.wait_for( + l, std::chrono::milliseconds(1000)); + } + } + RETURN_IF_ERROR(_state->exec_env()->group_commit_mgr()->get_first_block_load_queue( _db_id, _table_id, _base_schema_version, load_id, _load_block_queue, - _state->be_exec_version())); + _state->be_exec_version(), wal_dir)); + RETURN_IF_ERROR(wal_mgr->add_wal_path(_db_id, _table_id, _load_block_queue->txn_id, Review Comment: can move this to `LoadBlockQueue::create_wal` to hide the implementation -- 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