This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.1 by this push:
new f8e7ef2fd44 branch-3.1: [opt](create table) Fixed table creation
becomes slower as the number of tablets increases #52688 (#52919)
f8e7ef2fd44 is described below
commit f8e7ef2fd44ecc8e108014ed151388f3ebedd2ac
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Jul 8 17:43:12 2025 +0800
branch-3.1: [opt](create table) Fixed table creation becomes slower as the
number of tablets increases #52688 (#52919)
Cherry-picked from #52688
Co-authored-by: deardeng <[email protected]>
---
.../java/org/apache/doris/catalog/TabletInvertedIndex.java | 14 ++++++++++++++
.../java/org/apache/doris/system/SystemInfoService.java | 2 +-
2 files changed, 15 insertions(+), 1 deletion(-)
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 0362205dbde..a1faada3fea 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
@@ -718,6 +718,20 @@ public class TabletInvertedIndex {
}
}
+ public Long getTabletSizeByBackendId(long backendId) {
+ Long ret = 0L;
+ long stamp = readLock();
+ try {
+ Map<Long, Replica> replicaMetaWithBackend =
backingReplicaMetaTable.row(backendId);
+ if (replicaMetaWithBackend != null) {
+ ret += replicaMetaWithBackend.size();
+ }
+ } finally {
+ readUnlock(stamp);
+ }
+ return ret;
+ }
+
public List<Long> getTabletIdsByBackendId(long backendId) {
List<Long> tabletIds = Lists.newArrayList();
long stamp = readLock();
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/system/SystemInfoService.java
b/fe/fe-core/src/main/java/org/apache/doris/system/SystemInfoService.java
index ca67dff585b..660f256a592 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/system/SystemInfoService.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/system/SystemInfoService.java
@@ -470,7 +470,7 @@ public class SystemInfoService {
long minBeTabletsNum = Long.MAX_VALUE;
int minIndex = -1;
for (int i = 0; i < beIds.size(); ++i) {
- long tabletsNum =
Env.getCurrentInvertedIndex().getTabletIdsByBackendId(beIds.get(i)).size();
+ long tabletsNum =
Env.getCurrentInvertedIndex().getTabletSizeByBackendId(beIds.get(i));
if (tabletsNum < minBeTabletsNum) {
minBeTabletsNum = tabletsNum;
minIndex = i;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]