[BugFix](TabletInvertedIndex) fix replica not found in TabletInvertedIndex (#34117)
* fix replica not found in TabletInvertedIndex
This commit is contained in:
@ -617,8 +617,19 @@ 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);
|
||||
|
||||
// sometimes, replicas may have same replica id in different backend
|
||||
// we need to cover this situation to avoid some "replica not found" issue
|
||||
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);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("delete replica {} of tablet {} in backend {}",
|
||||
|
||||
Reference in New Issue
Block a user