You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xi...@apache.org on 2022/06/24 03:35:41 UTC

[iotdb] branch test_multileader updated: add synchronized when iterator Collections.synchronized.(set)

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

xingtanzjr pushed a commit to branch test_multileader
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/test_multileader by this push:
     new feab6fad35 add synchronized when iterator Collections.synchronized.(set)
feab6fad35 is described below

commit feab6fad358e58f558a886d709c2e7700ed9b720
Author: Jinrui.Zhang <xi...@gmail.com>
AuthorDate: Fri Jun 24 11:35:29 2022 +0800

    add synchronized when iterator Collections.synchronized.(set)
---
 .../iotdb/db/mpp/plan/analyze/ClusterPartitionFetcher.java   | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/ClusterPartitionFetcher.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/ClusterPartitionFetcher.java
index 8435e4b457..6b3bd6e605 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/ClusterPartitionFetcher.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/ClusterPartitionFetcher.java
@@ -460,11 +460,13 @@ public class ClusterPartitionFetcher implements IPartitionFetcher {
       } else {
         for (String devicePath : devicePaths) {
           boolean hit = false;
-          for (String storageGroup : storageGroupCache) {
-            if (PathUtils.isStartWith(devicePath, storageGroup)) {
-              deviceToStorageGroupMap.put(devicePath, storageGroup);
-              hit = true;
-              break;
+          synchronized (storageGroupCache) {
+            for (String storageGroup : storageGroupCache) {
+              if (PathUtils.isStartWith(devicePath, storageGroup)) {
+                deviceToStorageGroupMap.put(devicePath, storageGroup);
+                hit = true;
+                break;
+              }
             }
           }
           if (!hit) {