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

dataroaring 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 8d996fff659 [fix](cloud) Fix warm up `ConcurrentModificationException` 
exception (#53192)
8d996fff659 is described below

commit 8d996fff6594ddd644b83dbbc4bc6cdcc770397b
Author: deardeng <[email protected]>
AuthorDate: Tue Jul 29 22:55:58 2025 +0800

    [fix](cloud) Fix warm up `ConcurrentModificationException` exception 
(#53192)
    
    ### What problem does this PR solve?
    
    Fix
    ```
    2025-07-10 22:43:06,176 WARN (mysql-nio-pool-103558|311) 
[StmtExecutor.executeByLegacy():1152] execute Exception. stmt[176517899, 
6780b042fe344697-8e3ee529779cced7]
    java.util.ConcurrentModificationException: null
            at 
java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1013) ~[?:?]
            at java.util.ArrayList$Itr.next(ArrayList.java:967) ~[?:?]
            at 
org.apache.doris.cloud.catalog.CloudTabletRebalancer.getSnapshotTabletsInPrimaryByBeId(CloudTabletRebalancer.java:175)
 ~[doris-fe.jar:1.2-SNAPSHOT]
            at 
org.apache.doris.cloud.CacheHotspotManager.warmUpNewClusterByTable(CacheHotspotManager.java:562)
 ~[doris-fe.jar:1.2-SNAPSHOT]
            at 
org.apache.doris.cloud.CacheHotspotManager.createJob(CacheHotspotManager.java:589)
 ~[doris-fe.jar:1.2-SNAPSHOT]
            at 
org.apache.doris.qe.StmtExecutor.handleWarmUpStmt(StmtExecutor.java:2736) 
~[doris-fe.jar:1.2-SNAPSHOT]
            at 
org.apache.doris.qe.StmtExecutor.executeByLegacy(StmtExecutor.java:1124) 
~[doris-fe.jar:1.2-SNAPSHOT]
            at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:635) 
~[doris-fe.jar:1.2-SNAPSHOT]
            at 
org.apache.doris.qe.StmtExecutor.queryRetry(StmtExecutor.java:567) 
~[doris-fe.jar:1.2-SNAPSHOT]
            at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:557) 
~[doris-fe.jar:1.2-SNAPSHOT]
            at 
org.apache.doris.qe.ConnectProcessor.executeQuery(ConnectProcessor.java:340) 
~[doris-fe.jar:1.2-SNAPSHOT]
            at 
org.apache.doris.qe.ConnectProcessor.handleQuery(ConnectProcessor.java:243) 
~[doris-fe.jar:1.2-SNAPSHOT]
            at 
org.apache.doris.qe.MysqlConnectProcessor.handleQuery(MysqlConnectProcessor.java:207)
 ~[doris-fe.jar:1.2-SNAPSHOT]
            at 
org.apache.doris.qe.MysqlConnectProcessor.dispatch(MysqlConnectProcessor.java:235)
 ~[doris-fe.jar:1.2-SNAPSHOT]
            at 
org.apache.doris.qe.MysqlConnectProcessor.processOnce(MysqlConnectProcessor.java:412)
 ~[doris-fe.jar:1.2-SNAPSHOT]
            at 
org.apache.doris.mysql.ReadListener.lambda$handleEvent$0(ReadListener.java:52) 
~[doris-fe.jar:1.2-SNAPSHOT]
            at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) 
~[?:?]
            at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) 
~[?:?]
            at java.lang.Thread.run(Thread.java:833) ~[?:?]
    ```
    
    Issue Number: close #xxx
    
    Related PR: #xxx
    
    Problem Summary:
    
    ### Release note
    
    None
    
    ### Check List (For Author)
    
    - Test <!-- At least one of them must be included. -->
        - [ ] Regression test
        - [ ] Unit Test
        - [ ] Manual test (add detailed scripts or steps below)
        - [x] No need to test or manual test. Explain why:
    - [ ] This is a refactor/code format and no logic has been changed.
            - [x] Previous test can cover this change.
            - [ ] No code files have been changed.
            - [ ] Other reason <!-- Add your reason?  -->
    
    - Behavior changed:
        - [x] No.
        - [ ] Yes. <!-- Explain the behavior change -->
    
    - Does this need documentation?
        - [x] No.
    - [ ] Yes. <!-- Add document PR link here. eg:
    https://github.com/apache/doris-website/pull/1214 -->
    
    ### Check List (For Reviewer who merge this PR)
    
    - [ ] Confirm the release note
    - [ ] Confirm test cases
    - [ ] Confirm document
    - [ ] Add branch pick label <!-- Add branch pick label that this PR
    should merge into -->
---
 .../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