Skip to content
Merged
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
21 changes: 18 additions & 3 deletions fe/fe-core/src/main/java/org/apache/doris/catalog/Tablet.java
Original file line number Diff line number Diff line change
Expand Up @@ -303,23 +303,29 @@ protected Multimap<Long, Long> getNormalReplicaBackendPathMapCloud(String beEndp
(rep, be) -> ((CloudReplica) rep).getBackendId(be));
}

// When a BE reports a missing version, lastFailedVersion is set. When a write fails on a replica,
// lastFailedVersion is set.
// for query
public List<Replica> getQueryableReplicas(long visibleVersion, Map<Long, Set<Long>> backendAlivePathHashs,
boolean allowFailedVersion) {
boolean allowMissingVersion) {
List<Replica> allQueryableReplica = Lists.newArrayListWithCapacity(replicas.size());
List<Replica> auxiliaryReplica = Lists.newArrayListWithCapacity(replicas.size());
List<Replica> deadPathReplica = Lists.newArrayList();
List<Replica> mayMissingVersionReplica = Lists.newArrayList();
List<Replica> notCatchupReplica = Lists.newArrayList();

for (Replica replica : replicas) {
if (replica.isBad()) {
continue;
}

// Skip the missing version replica
Copy link
Contributor

@yujun777 yujun777 Apr 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if not allow missing version, must check last fail version < 0, line 318 ~ 321 cannot deleted, keep it

if (replica.getLastFailedVersion() > 0 && !allowFailedVersion) {
if (replica.getLastFailedVersion() > 0) {
mayMissingVersionReplica.add(replica);
continue;
}

if (!replica.checkVersionCatchUp(visibleVersion, false)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if be not found rowset [1, visible version], be maybe also throw a error

notCatchupReplica.add(replica);
continue;
}

Expand All @@ -345,6 +351,15 @@ public List<Replica> getQueryableReplicas(long visibleVersion, Map<Long, Set<Lon
allQueryableReplica = deadPathReplica;
}

if (allQueryableReplica.isEmpty()) {
// If be misses a version, be would report failure.
allQueryableReplica = mayMissingVersionReplica;
}

if (allQueryableReplica.isEmpty() && allowMissingVersion) {
allQueryableReplica = notCatchupReplica;
}

if (Config.skip_compaction_slower_replica && allQueryableReplica.size() > 1) {
long minVersionCount = allQueryableReplica.stream().mapToLong(Replica::getVisibleVersionCount)
.filter(count -> count != -1).min().orElse(Long.MAX_VALUE);
Expand Down
Loading