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 @@ -75,7 +75,9 @@ private static List<List<String>> getTabletStatus(String dbName, String tblName,

for (String partName : partitions) {
Partition partition = olapTable.getPartition(partName);
long visibleVersion = partition.getVisibleVersion();
// for local mode, getCachedVisibleVersion return visibleVersion.
// for cloud mode, the replica version is not updated.
long visibleVersion = partition.getCachedVisibleVersion();
short replicationNum = olapTable.getPartitionInfo()
.getReplicaAllocation(partition.getId()).getTotalReplicaNum();

Expand Down Expand Up @@ -180,7 +182,9 @@ private static List<List<String>> getTabletStatus(String dbName, String tblName,

for (String partName : partitions) {
Partition partition = olapTable.getPartition(partName);
long visibleVersion = partition.getVisibleVersion();
// for local mode, getCachedVisibleVersion return visibleVersion.
// for cloud mode, the replica version is not updated.
long visibleVersion = partition.getCachedVisibleVersion();
short replicationNum = olapTable.getPartitionInfo()
.getReplicaAllocation(partition.getId()).getTotalReplicaNum();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2250,7 +2250,9 @@ public Map<Tag, List<List<Long>>> getArbitraryTabletBucketsSeq() throws DdlExcep
public long proximateRowCount() {
long totalCount = 0;
for (Partition partition : getPartitions()) {
long version = partition.getVisibleVersion();
// for local mode, getCachedVisibleVersion return visibleVersion.
// for cloud mode, the replica.checkVersionCatchUp always returns true.
long version = partition.getCachedVisibleVersion();
for (MaterializedIndex index : partition.getMaterializedIndices(IndexExtState.VISIBLE)) {
for (Tablet tablet : index.getTablets()) {
long tabletRowCount = 0L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.apache.doris.analysis.UserIdentity;
import org.apache.doris.catalog.ColocateTableIndex.GroupId;
import org.apache.doris.catalog.Env;
import org.apache.doris.catalog.Partition;
import org.apache.doris.catalog.Replica;
import org.apache.doris.cloud.proto.Cloud;
import org.apache.doris.cloud.qe.ComputeGroupException;
Expand Down Expand Up @@ -544,16 +543,6 @@ public boolean checkVersionCatchUp(long expectedVersion, boolean ignoreAlter) {
// ATTN: expectedVersion is not used here, and OlapScanNode.addScanRangeLocations
// depends this feature to implement snapshot partition version. See comments in
// OlapScanNode.addScanRangeLocations for details.
if (ignoreAlter && getState() == ReplicaState.ALTER
&& getVersion() == Partition.PARTITION_INIT_VERSION) {
return true;
}

if (expectedVersion == Partition.PARTITION_INIT_VERSION) {
// no data is loaded into this replica, just return true
return true;
}

return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ protected Object rowcount(HttpServletRequest request, HttpServletResponse respon
olapTable.readLock();
try {
for (Partition partition : olapTable.getAllPartitions()) {
long version = partition.getVisibleVersion();
// for local mode, getCachedVisibleVersion return visibleVersion.
// for cloud mode, the replica.checkVersionCatchUp always returns true.
long version = partition.getCachedVisibleVersion();
for (MaterializedIndex index : partition.getMaterializedIndices(IndexExtState.VISIBLE)) {
long indexRowCount = 0L;
for (Tablet tablet : index.getTablets()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,6 @@ public PartitionSingle() {
this.fromCache = false;
this.tooNew = false;
}

public void debug() {
if (partition != null) {
LOG.info("partition id {}, cacheKey {}, version {}, time {}, fromCache {}, tooNew {} ",
partitionId, cacheKey.realValue(),
partition.getVisibleVersion(), partition.getVisibleVersionTime(),
fromCache, tooNew);
} else {
LOG.info("partition id {}, cacheKey {}, fromCache {}, tooNew {} ", partitionId,
cacheKey.realValue(), fromCache, tooNew);
}
}
}

public enum KeyType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,48 +154,4 @@ public PartitionRange.PartitionKeyType getKeyFromRow(byte[] row, int index, Type
}
return key;
}

/**
* Rowbatch split to Row
*/
public InternalService.PUpdateCacheRequest buildPartitionUpdateRequest(String sql) {
if (updateRequest == null) {
updateRequest = InternalService.PUpdateCacheRequest.newBuilder()
.setSqlKey(CacheProxy.getMd5(sql))
.setCacheType(InternalService.CacheType.PARTITION_CACHE).build();
}
HashMap<Long, List<byte[]>> partRowMap = new HashMap<>();
List<byte[]> partitionRowList;
PartitionRange.PartitionKeyType cacheKey;
for (byte[] row : rowList) {
cacheKey = getKeyFromRow(row, keyIndex, keyType);
if (!cachePartMap.containsKey(cacheKey.realValue())) {
LOG.info("cant find partition key {}", cacheKey.realValue());
continue;
}
if (!partRowMap.containsKey(cacheKey.realValue())) {
partitionRowList = Lists.newArrayList();
partitionRowList.add(row);
partRowMap.put(cacheKey.realValue(), partitionRowList);
} else {
partRowMap.get(cacheKey.realValue()).add(row);
}
}

for (HashMap.Entry<Long, List<byte[]>> entry : partRowMap.entrySet()) {
Long key = entry.getKey();
PartitionRange.PartitionSingle partition = cachePartMap.get(key);
partitionRowList = entry.getValue();
updateRequest = updateRequest.toBuilder()
.addValues(InternalService.PCacheValue.newBuilder()
.setParam(InternalService.PCacheParam.newBuilder()
.setPartitionKey(key)
.setLastVersion(partition.getPartition().getVisibleVersion())
.setLastVersionTime(partition.getPartition().getVisibleVersionTime())
.build()).setDataSize(dataSize).addAllRows(
partitionRowList.stream().map(ByteString::copyFrom)
.collect(Collectors.toList()))).build();
}
return updateRequest;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,10 @@ protected Pair<List<Long>, Long> getSampleTablets() {
for (int i = 0; i < tabletCounts; i++) {
int seekTid = (int) ((i + seek) % ids.size());
long tabletId = ids.get(seekTid);
long tabletRows = materializedIndex.getTablet(tabletId).getMinReplicaRowCount(p.getVisibleVersion());
// for local mode, getCachedVisibleVersion return visibleVersion.
// for cloud mode, the replica.checkVersionCatchUp always returns true.
long tabletRows = materializedIndex.getTablet(tabletId)
.getMinReplicaRowCount(p.getCachedVisibleVersion());
if (tabletRows > MAXIMUM_SAMPLE_ROWS) {
LOG.debug("Found one large tablet id {} in table {}, rows {}",
largeTabletId, tbl.getName(), largeTabletRows);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ public static List<List<String>> diagnoseTablet(long tabletId) {
StringBuilder versionErr = new StringBuilder();
StringBuilder statusErr = new StringBuilder();
StringBuilder compactionErr = new StringBuilder();
long visibleVersion = partition.getVisibleVersion();
// for local mode, getCachedVisibleVersion return visibleVersion.
// for cloud mode, the replica version is not updated.
long visibleVersion = partition.getCachedVisibleVersion();
for (Replica replica : replicas) {
// backend
do {
Expand Down
Loading