[fix](move-memtable) don't fail if success tablets to one BE is less than quorum (#29754)
This commit is contained in:
@ -541,7 +541,6 @@ Status VTabletWriterV2::close(Status exec_status) {
|
||||
}
|
||||
}
|
||||
|
||||
std::unordered_map<int64_t, int> success_tablets;
|
||||
std::unordered_map<int64_t, int> failed_tablets;
|
||||
|
||||
std::vector<TTabletCommitInfo> tablet_commit_infos;
|
||||
@ -564,21 +563,21 @@ Status VTabletWriterV2::close(Status exec_status) {
|
||||
commit_info.tabletId = tablet_id;
|
||||
commit_info.backendId = node_id;
|
||||
tablet_commit_infos.emplace_back(std::move(commit_info));
|
||||
success_tablets[tablet_id]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (auto [tablet_id, replicas] : success_tablets) {
|
||||
if (replicas > _num_replicas / 2) {
|
||||
continue;
|
||||
}
|
||||
return _failed_reason(tablet_id);
|
||||
}
|
||||
for (auto [tablet_id, replicas] : failed_tablets) {
|
||||
if (replicas <= (_num_replicas - 1) / 2) {
|
||||
continue;
|
||||
}
|
||||
return _failed_reason(tablet_id);
|
||||
auto backends = _location->find_tablet(tablet_id)->node_ids;
|
||||
for (auto& backend_id : backends) {
|
||||
auto failed_tablets = _streams_for_node[backend_id]->streams()[0]->failed_tablets();
|
||||
if (failed_tablets.contains(tablet_id)) {
|
||||
return failed_tablets[tablet_id];
|
||||
}
|
||||
}
|
||||
DCHECK(false) << "failed tablet " << tablet_id << " should have failed reason";
|
||||
}
|
||||
_state->tablet_commit_infos().insert(_state->tablet_commit_infos().end(),
|
||||
std::make_move_iterator(tablet_commit_infos.begin()),
|
||||
@ -604,19 +603,6 @@ Status VTabletWriterV2::close(Status exec_status) {
|
||||
return status;
|
||||
}
|
||||
|
||||
Status VTabletWriterV2::_failed_reason(int64_t tablet_id) {
|
||||
Status st = Status::InternalError("tablet {} failed", tablet_id);
|
||||
auto backends = _location->find_tablet(tablet_id)->node_ids;
|
||||
for (auto& backend_id : backends) {
|
||||
auto failed_tablets = _streams_for_node[backend_id]->streams()[0]->failed_tablets();
|
||||
if (failed_tablets.contains(tablet_id)) {
|
||||
st = failed_tablets[tablet_id];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return st;
|
||||
}
|
||||
|
||||
Status VTabletWriterV2::_close_load(const Streams& streams) {
|
||||
auto node_id = streams[0]->dst_id();
|
||||
std::vector<PTabletID> tablets_to_commit;
|
||||
|
||||
@ -140,8 +140,6 @@ private:
|
||||
Status _select_streams(int64_t tablet_id, int64_t partition_id, int64_t index_id,
|
||||
Streams& streams);
|
||||
|
||||
Status _failed_reason(int64_t tablet_id);
|
||||
|
||||
Status _close_load(const Streams& streams);
|
||||
|
||||
Status _cancel(Status status);
|
||||
|
||||
Reference in New Issue
Block a user