Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,6 @@ private void updateStatInfo(List<Long> dbIds) {
long tableReplicaCount = 0L;

long tableRowCount = 0L;
long tableRowsetCount = 0L;
long tableSegmentCount = 0L;

if (!table.readLockIfExist()) {
continue;
Expand Down Expand Up @@ -364,8 +362,6 @@ private void updateStatInfo(List<Long> dbIds) {
for (Tablet tablet : tablets) {
long tabletDataSize = 0L;

long tabletRowsetCount = 0L;
long tabletSegmentCount = 0L;
long tabletRowCount = 0L;
long tabletIndexSize = 0L;
long tabletSegmentSize = 0L;
Expand All @@ -380,14 +376,6 @@ private void updateStatInfo(List<Long> dbIds) {
tabletRowCount = replica.getRowCount();
}

if (replica.getRowsetCount() > tabletRowsetCount) {
tabletRowsetCount = replica.getRowsetCount();
}

if (replica.getSegmentCount() > tabletSegmentCount) {
tabletSegmentCount = replica.getSegmentCount();
}

if (replica.getLocalInvertedIndexSize() > tabletIndexSize) {
tabletIndexSize = replica.getLocalInvertedIndexSize();
}
Expand All @@ -410,8 +398,6 @@ private void updateStatInfo(List<Long> dbIds) {
tableRowCount += tabletRowCount;
indexRowCount += tabletRowCount;

tableRowsetCount += tabletRowsetCount;
tableSegmentCount += tabletSegmentCount;
tableTotalLocalIndexSize += tabletIndexSize;
tableTotalLocalSegmentSize += tabletSegmentSize;
} // end for tablets
Expand All @@ -435,7 +421,7 @@ private void updateStatInfo(List<Long> dbIds) {
// 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: {}",
Expand Down Expand Up @@ -503,14 +489,10 @@ private void updateTabletStat(GetTabletStatsResponse response, boolean activeUpd
}
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());
Expand Down
19 changes: 0 additions & 19 deletions fe/fe-core/src/main/java/org/apache/doris/catalog/Replica.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,25 +225,6 @@ public void setRowCount(long rowCount) {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>>();
Expand Down Expand Up @@ -325,30 +318,6 @@ private long getBackendIdImpl(String clusterId) throws ComputeGroupException {

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) {
Expand Down Expand Up @@ -487,17 +456,6 @@ private long getIndexByBeNum(long hashValue, int beNum) {
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
Expand Down Expand Up @@ -557,12 +515,9 @@ private List<Long> hashReplicaToBes(String clusterId, boolean isBackGround, int
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;
}

Expand Down Expand Up @@ -648,26 +603,6 @@ public List<Backend> getAllPrimaryBes() {
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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,6 @@ private void setTabletStats(long tableId, Partition partition, Partition serving
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());
Expand Down
Loading