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

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


The following commit(s) were added to refs/heads/branch-3.1 by this push:
     new c67e3e6649d branch-3.1: [fix](cloud) Fix warm up 
`ConcurrentModificationException` exception #53192 (#54052)
c67e3e6649d is described below

commit c67e3e6649d42d12d601275bc74d69a3f989a34a
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Jul 30 15:42:38 2025 +0800

    branch-3.1: [fix](cloud) Fix warm up `ConcurrentModificationException` 
exception #53192 (#54052)
    
    Cherry-picked from #53192
    
    Co-authored-by: deardeng <[email protected]>
---
 .../doris/cloud/catalog/CloudTabletRebalancer.java  | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudTabletRebalancer.java
 
b/fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudTabletRebalancer.java
index 17d72dd7446..e7f080ea329 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudTabletRebalancer.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudTabletRebalancer.java
@@ -157,7 +157,6 @@ public class CloudTabletRebalancer extends MasterDaemon {
         public Tablet pickedTablet;
         public long srcBe;
         public long destBe;
-        public boolean isGlobal;
         public Map<Long, Set<Tablet>> beToTablets;
         public long startTimestamp;
         BalanceType balanceType;
@@ -168,21 +167,22 @@ public class CloudTabletRebalancer extends MasterDaemon {
         public long destBe;
         public long minTabletsNum;
         public long maxTabletsNum;
-        public boolean srcDecommissioned;
     }
 
     public Set<Long> getSnapshotTabletsInPrimaryByBeId(Long beId) {
         Set<Long> tabletIds = Sets.newHashSet();
         Set<Tablet> tablets = beToTabletsGlobal.get(beId);
         if (tablets != null) {
-            for (Tablet tablet : tablets) {
+            //  Create a copy
+            for (Tablet tablet : new HashSet<>(tablets)) {
                 tabletIds.add(tablet.getId());
             }
         }
 
-        tablets = beToColocateTabletsGlobal.get(beId);
-        if (tablets != null) {
-            for (Tablet tablet : tablets) {
+        Set<Tablet> colocateTablets = beToColocateTabletsGlobal.get(beId);
+        if (colocateTablets != null) {
+            //  Create a copy
+            for (Tablet tablet : new HashSet<>(colocateTablets)) {
                 tabletIds.add(tablet.getId());
             }
         }
@@ -194,7 +194,8 @@ public class CloudTabletRebalancer extends MasterDaemon {
         Set<Long> tabletIds = Sets.newHashSet();
         Set<Tablet> tablets = beToTabletsGlobalInSecondary.get(beId);
         if (tablets != null) {
-            for (Tablet tablet : tablets) {
+            //  Create a copy
+            for (Tablet tablet : new HashSet<>(tablets)) {
                 tabletIds.add(tablet.getId());
             }
         }
@@ -212,8 +213,10 @@ public class CloudTabletRebalancer extends MasterDaemon {
         Set<Tablet> tablets = beToTabletsGlobal.get(beId);
         Set<Tablet> colocateTablets = beToColocateTabletsGlobal.get(beId);
 
-        return (tablets == null ? 0 : tablets.size())
-                + (colocateTablets == null ? 0 : colocateTablets.size());
+        int tabletsSize = (tablets == null) ? 0 : tablets.size();
+        int colocateTabletsSize = (colocateTablets == null) ? 0 : 
colocateTablets.size();
+
+        return tabletsSize + colocateTabletsSize;
     }
 
     // 1 build cluster to backends info


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

Reply via email to