dataroaring commented on code in PR #52354:
URL: https://github.com/apache/doris/pull/52354#discussion_r2174391808
##########
be/src/vec/sink/writer/vtablet_writer.cpp:
##########
@@ -330,17 +363,89 @@ Status IndexChannel::check_each_node_channel_close(
if (node_channel_closed) {
close_status = it.second->after_close_handle(_parent->_state,
writer_stats,
node_add_batch_counter_map);
- unfinished_node_channel_ids->erase(it.first);
}
if (!close_status.ok()) {
final_status = cancel_channel_and_check_intolerable_failure(
std::move(final_status), close_status.to_string(), *this,
*it.second);
+ } else if (node_channel_closed) {
+ unfinished_node_channel_ids->erase(it.first);
}
}
return final_status;
}
+bool IndexChannel::_quorum_success(const std::unordered_set<int64_t>&
unfinished_node_channel_ids) {
+ const int quorum = _parent->_num_replicas / 2 + 1;
+ std::unordered_map<int64_t, int64_t> finished_tablets_replica;
+ std::unordered_set<int64_t> write_tablets;
+
+ // 1. collect all write tablets and finished tablets
+ for (const auto& [node_id, node_channel] : _node_channels) {
+ auto node_channel_write_tablets = node_channel->write_tablets();
+ write_tablets.insert(node_channel_write_tablets.begin(),
node_channel_write_tablets.end());
+ if (unfinished_node_channel_ids.contains(node_id)) {
+ continue;
+ }
+ for (const auto& tablet_id : node_channel_write_tablets) {
+ finished_tablets_replica[tablet_id]++;
+ }
+ }
+
+ // 2. check if quorum success
+ if (write_tablets.empty()) {
+ return false;
+ }
+ for (const auto& tablet_id : write_tablets) {
+ if (finished_tablets_replica[tablet_id] < quorum) {
Review Comment:
there is a min replica load in fe, we should follow it.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]