weizuo93 commented on code in PR #10298: URL: https://github.com/apache/doris/pull/10298#discussion_r923433526
########## be/src/runtime/tablets_channel.cpp: ########## @@ -124,20 +133,46 @@ Status TabletsChannel::close(int sender_id, int64_t backend_id, bool* finished, } } + _write_single_replica = write_single_replica; + // 2. wait delta writers and build the tablet vector for (auto writer : need_wait_writers) { + PSlaveTabletNodes slave_nodes; + if (write_single_replica) { + slave_nodes = slave_tablet_nodes.at(writer->tablet_id()); + } // close may return failed, but no need to handle it here. // tablet_vec will only contains success tablet, and then let FE judge it. - _close_wait(writer, tablet_vec, tablet_errors); + _close_wait(writer, tablet_vec, tablet_errors, slave_nodes, write_single_replica); + } + + if (write_single_replica) { + CountDownLatch latch(1); + while (need_wait_writers.size() > 0 && + (time(nullptr) - parent->last_updated_time()) < (parent->timeout() * 0.9)) { + for (auto writer : need_wait_writers) { + bool is_done = writer->check_slave_replicas_done(success_slave_tablet_node_ids); + if (is_done) { + need_wait_writers.erase(writer); Review Comment: > Is it safe to erase a map's element when it is being iterated? done -- 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