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

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


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

commit 61eb141a150660f112396c4091af52ec23c38dc6
Author: yujun <yu.jun.re...@gmail.com>
AuthorDate: Tue Jun 11 14:45:10 2024 +0800

    [fix](clone) fix check replica failed due to replica had drop #35994 
(#36087)
    
    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 b40d7f7a512..f188abef02c 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
@@ -209,7 +209,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;
                 }
@@ -218,6 +223,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) {
@@ -240,7 +246,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 fc9fb0c7a65..a0130e80c4e 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
@@ -213,7 +213,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;
                 }
@@ -300,7 +305,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, "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