This is an automated email from the ASF dual-hosted git repository. dataroaring pushed a commit to branch branch-3.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push: new 23623e7a457 branch-3.0: [fix](replica) skip missing version should care catchup #49999 (#50087) 23623e7a457 is described below commit 23623e7a457e6f06c7e444f7997a7eddafca3561 Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> AuthorDate: Mon Apr 28 11:04:02 2025 +0800 branch-3.0: [fix](replica) skip missing version should care catchup #49999 (#50087) Cherry-picked from #49999 Co-authored-by: Yongqiang YANG <yangyongqi...@selectdb.com> --- .../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