This is an automated email from the ASF dual-hosted git repository.

kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 93a83b54dda427b3efc24e3b2dd95fd0b35daa46
Author: yujun <[email protected]>
AuthorDate: Sat Sep 9 00:42:32 2023 +0800

    [fix](tablet clone) delete tablet check other catchup #24038
    
    Sometimes FE replica's version is unreliable. FE's replica may bigger than 
BE's real version. Need check if BE missing version (last failed version > 0).
---
 .../main/java/org/apache/doris/clone/TabletScheduler.java   | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/clone/TabletScheduler.java 
b/fe/fe-core/src/main/java/org/apache/doris/clone/TabletScheduler.java
index d791b53475..8cd3e92131 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/clone/TabletScheduler.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/clone/TabletScheduler.java
@@ -1056,14 +1056,11 @@ public class TabletScheduler extends MasterDaemon {
             Replica replica, String reason, boolean force) throws 
SchedException {
 
         List<Replica> replicas = tabletCtx.getTablet().getReplicas();
-        int matchupReplicaCount = 0;
-        for (Replica tmpReplica : replicas) {
-            if (tmpReplica.getVersion() >= replica.getVersion()) {
-                matchupReplicaCount++;
-            }
-        }
-
-        if (matchupReplicaCount <= 1) {
+        boolean otherCatchup = replicas.stream().anyMatch(
+                r -> r.getId() != replica.getId()
+                && (r.getVersion() > replica.getVersion()
+                        || (r.getVersion() == replica.getVersion() && 
r.getLastFailedVersion() < 0)));
+        if (!otherCatchup) {
             LOG.info("can not delete only one replica, tabletId = {} replicaId 
= {}", tabletCtx.getTabletId(),
                      replica.getId());
             throw new SchedException(Status.UNRECOVERABLE, "the only one 
latest replia can not be dropped, tabletId = "


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to