This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.1 by this push:
new fde5aec7117 branch-4.1: [opt](memory) Remove unused fields from
CloudReplica #62125 (#62156)
fde5aec7117 is described below
commit fde5aec7117d236939e12031011c757b090f4deb
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri May 29 14:29:43 2026 +0800
branch-4.1: [opt](memory) Remove unused fields from CloudReplica #62125
(#62156)
Cherry-picked from #62125
Co-authored-by: Yongqiang YANG <[email protected]>
---
.../apache/doris/catalog/CloudTabletStatMgr.java | 20 +------
.../java/org/apache/doris/catalog/Replica.java | 19 -------
.../apache/doris/cloud/catalog/CloudReplica.java | 65 ----------------------
.../java/org/apache/doris/master/Checkpoint.java | 2 -
4 files changed, 1 insertion(+), 105 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/catalog/CloudTabletStatMgr.java
b/fe/fe-core/src/main/java/org/apache/doris/catalog/CloudTabletStatMgr.java
index 70ab983c231..c9b2a4c6209 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/CloudTabletStatMgr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/CloudTabletStatMgr.java
@@ -328,8 +328,6 @@ public class CloudTabletStatMgr extends MasterDaemon {
long tableReplicaCount = 0L;
long tableRowCount = 0L;
- long tableRowsetCount = 0L;
- long tableSegmentCount = 0L;
if (!table.readLockIfExist()) {
continue;
@@ -364,8 +362,6 @@ public class CloudTabletStatMgr extends MasterDaemon {
for (Tablet tablet : tablets) {
long tabletDataSize = 0L;
- long tabletRowsetCount = 0L;
- long tabletSegmentCount = 0L;
long tabletRowCount = 0L;
long tabletIndexSize = 0L;
long tabletSegmentSize = 0L;
@@ -381,14 +377,6 @@ public class CloudTabletStatMgr extends MasterDaemon {
tabletRowCount = replica.getRowCount();
}
- if (replica.getRowsetCount() >
tabletRowsetCount) {
- tabletRowsetCount =
replica.getRowsetCount();
- }
-
- if (replica.getSegmentCount() >
tabletSegmentCount) {
- tabletSegmentCount =
replica.getSegmentCount();
- }
-
if (replica.getLocalInvertedIndexSize() >
tabletIndexSize) {
tabletIndexSize =
replica.getLocalInvertedIndexSize();
}
@@ -411,8 +399,6 @@ public class CloudTabletStatMgr extends MasterDaemon {
tableRowCount += tabletRowCount;
indexRowCount += tabletRowCount;
- tableRowsetCount += tabletRowsetCount;
- tableSegmentCount += tabletSegmentCount;
tableTotalLocalIndexSize += tabletIndexSize;
tableTotalLocalSegmentSize +=
tabletSegmentSize;
} // end for tablets
@@ -436,7 +422,7 @@ public class CloudTabletStatMgr extends MasterDaemon {
// this is only one thread to update table statistics,
readLock is enough
tableStats = new OlapTable.Statistics(db.getName(),
table.getName(), tableDataSize,
tableTotalReplicaDataSize, 0L,
- tableReplicaCount, tableRowCount,
tableRowsetCount, tableSegmentCount,
+ tableReplicaCount, tableRowCount, 0L, 0L,
tableTotalLocalIndexSize,
tableTotalLocalSegmentSize, 0L, 0L);
olapTable.setStatistics(tableStats);
LOG.debug("finished to set row num for table: {} in
database: {}",
@@ -504,14 +490,10 @@ public class CloudTabletStatMgr extends MasterDaemon {
}
Replica replica = replicas.get(0);
boolean statsChanged = replica.getDataSize() != stat.getDataSize()
- || replica.getRowsetCount() != stat.getNumRowsets()
- || replica.getSegmentCount() != stat.getNumSegments()
|| replica.getRowCount() != stat.getNumRows()
|| replica.getLocalInvertedIndexSize() !=
stat.getIndexSize()
|| replica.getLocalSegmentSize() != stat.getSegmentSize();
replica.setDataSize(stat.getDataSize());
- replica.setRowsetCount(stat.getNumRowsets());
- replica.setSegmentCount(stat.getNumSegments());
replica.setRowCount(stat.getNumRows());
replica.setLocalInvertedIndexSize(stat.getIndexSize());
replica.setLocalSegmentSize(stat.getSegmentSize());
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Replica.java
b/fe/fe-core/src/main/java/org/apache/doris/catalog/Replica.java
index d087d944c1d..ad83287925c 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Replica.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Replica.java
@@ -225,25 +225,6 @@ public abstract class Replica {
this.rowCount = rowCount;
}
- public long getSegmentCount() {
- return 0;
- }
-
- public void setSegmentCount(long segmentCount) {
- if (segmentCount > 0) {
- throw new UnsupportedOperationException("setSegmentCount is not
supported in Replica");
- }
- }
-
- public long getRowsetCount() {
- return 0;
- }
-
- public void setRowsetCount(long rowsetCount) {
- if (rowsetCount > 0) {
- throw new UnsupportedOperationException("setRowsetCount is not
supported in Replica");
- }
- }
public long getLastFailedVersion() {
return -1;
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudReplica.java
b/fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudReplica.java
index c50b5d80923..40cf978b4c2 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudReplica.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudReplica.java
@@ -86,15 +86,8 @@ public class CloudReplica extends Replica implements
GsonPostProcessable {
@SerializedName(value = "sii")
int statsIntervalIndex = 0;
- @SerializedName(value = "sc")
- private long segmentCount = 0L;
- @SerializedName(value = "rsc")
- private long rowsetCount = 1L; // [0-1] rowset
-
private static final Random rand = new Random();
- private Map<String, List<Long>> memClusterToBackends = null;
-
// clusterId, secondaryBe, changeTimestamp
private Map<String, Pair<Long, Long>> secondaryClusterToBackends
= new ConcurrentHashMap<String, Pair<Long, Long>>();
@@ -325,30 +318,6 @@ public class CloudReplica extends Replica implements
GsonPostProcessable {
if (Config.enable_cloud_multi_replica) {
int indexRand = rand.nextInt(Config.cloud_replica_num);
- int coldReadRand = rand.nextInt(100);
- boolean allowColdRead = coldReadRand <
Config.cloud_cold_read_percent;
- initMemClusterToBackends();
- boolean replicaEnough = memClusterToBackends.get(clusterId) != null
- && memClusterToBackends.get(clusterId).size() > indexRand;
-
- long backendId = -1;
- if (replicaEnough) {
- backendId = memClusterToBackends.get(clusterId).get(indexRand);
- }
-
- if (!replicaEnough && !allowColdRead &&
primaryClusterToBackend.containsKey(clusterId)) {
- backendId = primaryClusterToBackend.get(clusterId);
- }
-
- if (backendId > 0) {
- Backend be = Env.getCurrentSystemInfo().getBackend(backendId);
- if (be != null && be.isQueryAvailable()) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("backendId={} ", backendId);
- }
- return backendId;
- }
- }
List<Long> res = hashReplicaToBes(clusterId, false,
Config.cloud_replica_num);
if (res.size() < indexRand + 1) {
@@ -487,17 +456,6 @@ public class CloudReplica extends Replica implements
GsonPostProcessable {
return (hashValue % beNum + beNum) % beNum;
}
- private void initMemClusterToBackends() {
- // the enable_cloud_multi_replica is not used now
- if (memClusterToBackends == null) {
- synchronized (this) {
- if (memClusterToBackends == null) {
- memClusterToBackends = new ConcurrentHashMap<>();
- }
- }
- }
- }
-
private List<Long> hashReplicaToBes(String clusterId, boolean
isBackGround, int replicaNum)
throws ComputeGroupException {
// TODO(luwei) list should be sorted
@@ -557,12 +515,9 @@ public class CloudReplica extends Replica implements
GsonPostProcessable {
LOG.info("picked beId {}, replicaId {}, partId {}, beNum {},
replicaIdx {}, picked Index {}, hashVal {}",
pickedBeId, getId(), partitionId, availableBes.size(),
idx, index,
hashCode == null ? -1 : hashCode.asLong());
- // save to memClusterToBackends map
bes.add(pickedBeId);
}
- memClusterToBackends.put(clusterId, bes);
-
return bes;
}
@@ -648,26 +603,6 @@ public class CloudReplica extends Replica implements
GsonPostProcessable {
return result;
}
- @Override
- public long getSegmentCount() {
- return segmentCount;
- }
-
- @Override
- public void setSegmentCount(long segmentCount) {
- this.segmentCount = segmentCount;
- }
-
- @Override
- public long getRowsetCount() {
- return rowsetCount;
- }
-
- @Override
- public void setRowsetCount(long rowsetCount) {
- this.rowsetCount = rowsetCount;
- }
-
@Override
public void gsonPostProcess() throws IOException {
if (LOG.isDebugEnabled()) {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/master/Checkpoint.java
b/fe/fe-core/src/main/java/org/apache/doris/master/Checkpoint.java
index 0d21fa8094c..b908954541d 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/master/Checkpoint.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/master/Checkpoint.java
@@ -499,8 +499,6 @@ public class Checkpoint extends MasterDaemon {
continue;
}
replica.setDataSize(servingReplica.getDataSize());
- replica.setRowsetCount(servingReplica.getRowsetCount());
- replica.setSegmentCount(servingReplica.getSegmentCount());
replica.setRowCount(servingReplica.getRowCount());
replica.setLocalInvertedIndexSize(servingReplica.getLocalInvertedIndexSize());
replica.setLocalSegmentSize(servingReplica.getLocalSegmentSize());
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]