This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new b05459d25e6 branch-4.0: [opt](memory) remove useless
replicaToTabletMap in TabletInvertedIndex #57011 (#57037)
b05459d25e6 is described below
commit b05459d25e65e2d96cdb1a058c96f2a1c65cd18c
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Oct 16 18:00:59 2025 +0800
branch-4.0: [opt](memory) remove useless replicaToTabletMap in
TabletInvertedIndex #57011 (#57037)
Cherry-picked from #57011
Co-authored-by: Yongqiang YANG <[email protected]>
---
.../apache/doris/catalog/TabletInvertedIndex.java | 34 ----------------------
.../main/java/org/apache/doris/load/DeleteJob.java | 5 ----
2 files changed, 39 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 a1faada3fea..1b37e7f3a6c 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
@@ -79,9 +79,6 @@ public class TabletInvertedIndex {
// tablet id -> tablet meta
private Map<Long, TabletMeta> tabletMetaMap = Maps.newHashMap();
- // replica id -> tablet id
- private Map<Long, Long> replicaToTabletMap = Maps.newHashMap();
-
/*
* we use this to save memory.
* we do not need create TabletMeta instance for each tablet,
@@ -399,15 +396,6 @@ public class TabletInvertedIndex {
}
}
- public Long getTabletIdByReplica(long replicaId) {
- long stamp = readLock();
- try {
- return replicaToTabletMap.get(replicaId);
- } finally {
- readUnlock(stamp);
- }
- }
-
public TabletMeta getTabletMeta(long tabletId) {
long stamp = readLock();
try {
@@ -610,10 +598,6 @@ public class TabletInvertedIndex {
try {
Map<Long, Replica> replicas =
replicaMetaTable.rowMap().remove(tabletId);
if (replicas != null) {
- for (Replica replica : replicas.values()) {
- replicaToTabletMap.remove(replica.getId());
- }
-
for (long backendId : replicas.keySet()) {
backingReplicaMetaTable.remove(backendId, tabletId);
}
@@ -643,7 +627,6 @@ public class TabletInvertedIndex {
"tablet " + tabletId + " not exists, replica " +
replica.getId()
+ ", backend " + backendId);
replicaMetaTable.put(tabletId, backendId, replica);
- replicaToTabletMap.put(replica.getId(), tabletId);
backingReplicaMetaTable.put(backendId, tabletId, replica);
if (LOG.isDebugEnabled()) {
LOG.debug("add replica {} of tablet {} in backend {}",
@@ -665,18 +648,6 @@ public class TabletInvertedIndex {
if (replicaMetaTable.containsRow(tabletId)) {
Replica replica = 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 {}",
@@ -812,7 +783,6 @@ public class TabletInvertedIndex {
long stamp = writeLock();
try {
tabletMetaMap.clear();
- replicaToTabletMap.clear();
tabletMetaTable.clear();
replicaMetaTable.clear();
backingReplicaMetaTable.clear();
@@ -825,10 +795,6 @@ public class TabletInvertedIndex {
this.partitionCollectInfoMap = partitionCollectInfoMap;
}
- public Map<Long, Long> getReplicaToTabletMap() {
- return replicaToTabletMap;
- }
-
// Only build from available bes, exclude colocate tables
public Map<TStorageMedium, TreeMultimap<Long, PartitionBalanceInfo>>
buildPartitionInfoBySkew(
List<Long> availableBeIds, Map<Long, Pair<TabletMove, Long>>
movesInProgress) {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/load/DeleteJob.java
b/fe/fe-core/src/main/java/org/apache/doris/load/DeleteJob.java
index 5c0c5f8cc31..2f619a4cc53 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/load/DeleteJob.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/load/DeleteJob.java
@@ -440,14 +440,9 @@ public class DeleteJob extends
AbstractTxnStateChangeCallback implements DeleteJ
}
protected List<TabletCommitInfo> generateTabletCommitInfos() {
- TabletInvertedIndex currentInvertedIndex =
Env.getCurrentInvertedIndex();
List<TabletCommitInfo> tabletCommitInfos = Lists.newArrayList();
tabletDeleteInfoMap.forEach((tabletId, deleteInfo) ->
deleteInfo.getFinishedReplicas()
.forEach(replica -> {
- if
(currentInvertedIndex.getTabletIdByReplica(replica.getId()) == null) {
- LOG.warn("could not find tablet id for replica {}, the
tablet maybe dropped", replica);
- return;
- }
tabletCommitInfos.add(new TabletCommitInfo(tabletId,
replica.getBackendIdWithoutException()));
}));
return tabletCommitInfos;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]