This is an automated email from the ASF dual-hosted git repository. yangbowen pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push: new 993c3c376d0 [BugFix](TabletInvertedIndex) fix replica not found in TabletInvertedIndex (#35791) 993c3c376d0 is described below commit 993c3c376d0ca3662a1bfaf57496b32168ac3a6e Author: shouchengShen <50309488+johnny...@users.noreply.github.com> AuthorDate: Tue Jun 4 16:32:23 2024 +0800 [BugFix](TabletInvertedIndex) fix replica not found in TabletInvertedIndex (#35791) ## Proposed changes adding and dropping backend in cluster may lead to the different replica in different backend have the same replica id, at that time, 'delete from table partition xxx' operation will be failed with exception:'Failed to commit txn 862, cause tablet 11653 succ replica num 1 < quorum replica num 2. ...' and also, with the above delete operation, drop replica operation(class:TabletInvertedIndex) will be failed with WARN log: ' could not find tablet id for replica xxx, the tablet maybe dropped' fix in master branch already merged: #34117 Co-authored-by: shenshoucheng <shenshouch...@jd.com> --- .../java/org/apache/doris/catalog/TabletInvertedIndex.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/TabletInvertedIndex.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/TabletInvertedIndex.java index 9f9f3fdc698..1c337740de9 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/TabletInvertedIndex.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/TabletInvertedIndex.java @@ -574,8 +574,16 @@ public class TabletInvertedIndex { "tablet " + tabletId + " not exists, backend " + backendId); if (replicaMetaTable.containsRow(tabletId)) { Replica replica = replicaMetaTable.remove(tabletId, backendId); - replicaToTabletMap.remove(replica.getId()); - replicaMetaTable.remove(tabletId, backendId); + if (replicaMetaTable.containsRow(tabletId)) { + long replicaNum = replicaMetaTable.row(tabletId).values().stream() + .filter(c -> c.getId() == replica.getId()).count(); + if (replicaNum == 0) { + replicaToTabletMap.remove(replica.getId()); + } + } else { + replicaToTabletMap.remove(replica.getId()); + } + backingReplicaMetaTable.remove(backendId, tabletId); LOG.debug("delete replica {} of tablet {} in backend {}", replica.getId(), tabletId, backendId); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org