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

yiguolei 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 e06c613f9a [fix](meta)Fix FE try to repair a tablet witch can not be 
repaired. #17959
e06c613f9a is described below

commit e06c613f9a412469307744acae811ca317be1538
Author: Lijia Liu <[email protected]>
AuthorDate: Sun Mar 26 20:11:14 2023 +0800

    [fix](meta)Fix FE try to repair a tablet witch can not be repaired. #17959
---
 .../src/main/java/org/apache/doris/catalog/Tablet.java      | 13 +++++++------
 1 file changed, 7 insertions(+), 6 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 affee2b79c..8406346dcb 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
@@ -490,11 +490,14 @@ public class Tablet extends MetaObject implements 
Writable {
             currentAllocMap.put(backend.getLocationTag(), (short) (curNum + 
1));
         }
 
+        // 0. We can not choose a good replica as src to repair this tablet.
+        if (aliveAndVersionComplete == 0) {
+            return Pair.of(TabletStatus.UNRECOVERABLE, Priority.VERY_HIGH);
+        }
+
         // 1. alive replicas are not enough
         int aliveBackendsNum = aliveBeIdsInCluster.size();
-        if (alive == 0) {
-            return Pair.of(TabletStatus.UNRECOVERABLE, Priority.VERY_HIGH);
-        } else if (alive < replicationNum && replicas.size() >= 
aliveBackendsNum
+        if (alive < replicationNum && replicas.size() >= aliveBackendsNum
                 && aliveBackendsNum >= replicationNum && replicationNum > 1) {
             // there is no enough backend for us to create a new replica, so 
we have to delete an existing replica,
             // so there can be available backend for us to create a new 
replica.
@@ -513,9 +516,7 @@ public class Tablet extends MetaObject implements Writable {
         }
 
         // 2. version complete replicas are not enough
-        if (aliveAndVersionComplete == 0) {
-            return Pair.of(TabletStatus.UNRECOVERABLE, Priority.VERY_HIGH);
-        } else if (aliveAndVersionComplete < (replicationNum / 2) + 1) {
+        if (aliveAndVersionComplete < (replicationNum / 2) + 1) {
             return Pair.of(TabletStatus.VERSION_INCOMPLETE, 
TabletSchedCtx.Priority.HIGH);
         } else if (aliveAndVersionComplete < replicationNum) {
             return Pair.of(TabletStatus.VERSION_INCOMPLETE, 
TabletSchedCtx.Priority.NORMAL);


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

Reply via email to