This is an automated email from the ASF dual-hosted git repository. gavinchou pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new bb4bacd9682 [fix](replica) skip missing version should care catchup (#49999) bb4bacd9682 is described below commit bb4bacd968273e563317a62bbed008789138c901 Author: Yongqiang YANG <yangyongqi...@selectdb.com> AuthorDate: Wed Apr 16 14:10:38 2025 +0800 [fix](replica) skip missing version should care catchup (#49999) --- .../main/java/org/apache/doris/catalog/Tablet.java | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Tablet.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Tablet.java index 2dfdab1ad3d..ca7f51da823 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Tablet.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Tablet.java @@ -303,23 +303,29 @@ public class Tablet extends MetaObject { (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 - if (replica.getLastFailedVersion() > 0 && !allowFailedVersion) { + if (replica.getLastFailedVersion() > 0) { + mayMissingVersionReplica.add(replica); continue; } if (!replica.checkVersionCatchUp(visibleVersion, false)) { + notCatchupReplica.add(replica); continue; } @@ -345,6 +351,15 @@ public class Tablet extends MetaObject { 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); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org