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

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


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new e51cd58d6e2 [fix](clone) fix check replica failed due to replica had 
drop #35994 (#36219)
e51cd58d6e2 is described below

commit e51cd58d6e217d5022ab0291444127e08105606e
Author: yujun <yu.jun.re...@gmail.com>
AuthorDate: Thu Jun 13 13:39:09 2024 +0800

    [fix](clone) fix check replica failed due to replica had drop #35994 
(#36219)
    
    cherry pick from #35994
---
 .../main/java/org/apache/doris/clone/BeLoadRebalancer.java | 10 ++++++++--
 .../main/java/org/apache/doris/clone/DiskRebalancer.java   | 14 ++++++++++++--
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/clone/BeLoadRebalancer.java 
b/fe/fe-core/src/main/java/org/apache/doris/clone/BeLoadRebalancer.java
index 67b5a6a6029..0da7428e422 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/clone/BeLoadRebalancer.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/clone/BeLoadRebalancer.java
@@ -213,7 +213,12 @@ public class BeLoadRebalancer extends Rebalancer {
                     continue;
                 }
 
-                Replica replica = invertedIndex.getReplica(tabletId, 
beStat.getBeId());
+                Replica replica = null;
+                try {
+                    replica = invertedIndex.getReplica(tabletId, 
beStat.getBeId());
+                } catch (IllegalStateException e) {
+                    continue;
+                }
                 if (replica == null) {
                     continue;
                 }
@@ -222,6 +227,7 @@ public class BeLoadRebalancer extends Rebalancer {
                 // and only select it if the selected tablets num of this path
                 // does not exceed the limit (BALANCE_SLOT_NUM_FOR_PATH).
                 long replicaPathHash = replica.getPathHash();
+                long replicaDataSize = replica.getDataSize();
                 if (remainingPaths.containsKey(replicaPathHash)) {
                     TabletMeta tabletMeta = 
invertedIndex.getTabletMeta(tabletId);
                     if (tabletMeta == null) {
@@ -244,7 +250,7 @@ public class BeLoadRebalancer extends Rebalancer {
                         continue;
                     }
 
-                    boolean isFit = lowBEs.stream().anyMatch(be -> 
be.isFit(replica.getDataSize(),
+                    boolean isFit = lowBEs.stream().anyMatch(be -> 
be.isFit(replicaDataSize,
                             medium, null, false) == BalanceStatus.OK);
                     if (!isFit) {
                         if (LOG.isDebugEnabled()) {
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/clone/DiskRebalancer.java 
b/fe/fe-core/src/main/java/org/apache/doris/clone/DiskRebalancer.java
index ae2fe44a7b8..96eef52d597 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/clone/DiskRebalancer.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/clone/DiskRebalancer.java
@@ -217,7 +217,12 @@ public class DiskRebalancer extends Rebalancer {
                         && 
invertedIndex.getReplicasByTabletId(tabletId).size() <= 1) {
                     continue;
                 }
-                Replica replica = invertedIndex.getReplica(tabletId, 
beStat.getBeId());
+                Replica replica = null;
+                try {
+                    replica = invertedIndex.getReplica(tabletId, 
beStat.getBeId());
+                } catch (IllegalStateException e) {
+                    continue;
+                }
                 if (replica == null) {
                     continue;
                 }
@@ -304,7 +309,12 @@ public class DiskRebalancer extends Rebalancer {
             throw new SchedException(Status.UNRECOVERABLE,
                 "src does not appear to be set correctly, something goes 
wrong");
         }
-        Replica replica = invertedIndex.getReplica(tabletCtx.getTabletId(), 
tabletCtx.getTempSrcBackendId());
+        Replica replica = null;
+        try {
+            replica = invertedIndex.getReplica(tabletCtx.getTabletId(), 
tabletCtx.getTempSrcBackendId());
+        } catch (IllegalStateException e) {
+            replica = null;
+        }
         // check src replica still there
         if (replica == null || replica.getPathHash() != 
tabletCtx.getTempSrcPathHash()) {
             throw new SchedException(Status.UNRECOVERABLE, 
SubCode.DIAGNOSE_IGNORE, "src replica may be rebalanced");


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to