You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ro...@apache.org on 2023/09/07 04:46:34 UTC

[iotdb] 01/02: try to fix ConcurrentModificationException when assigning PipeHeartbeatEvent

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

rong pushed a commit to branch fix-pipe-concurrent
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit e67b113b8856b43abd084f437d5ee5c8851273b3
Author: 马子坤 <55...@users.noreply.github.com>
AuthorDate: Wed Sep 6 19:33:09 2023 +0800

    try to fix ConcurrentModificationException when assigning PipeHeartbeatEvent
---
 .../db/pipe/extractor/realtime/matcher/CachedSchemaPatternMatcher.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/extractor/realtime/matcher/CachedSchemaPatternMatcher.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/extractor/realtime/matcher/CachedSchemaPatternMatcher.java
index 32c0fb2e9d0..e3730acb38d 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/extractor/realtime/matcher/CachedSchemaPatternMatcher.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/extractor/realtime/matcher/CachedSchemaPatternMatcher.java
@@ -33,6 +33,7 @@ import org.slf4j.LoggerFactory;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 public class CachedSchemaPatternMatcher implements PipeDataRegionMatcher {
@@ -46,7 +47,7 @@ public class CachedSchemaPatternMatcher implements PipeDataRegionMatcher {
 
   public CachedSchemaPatternMatcher() {
     this.lock = new ReentrantReadWriteLock();
-    this.extractors = new HashSet<>();
+    this.extractors = new CopyOnWriteArraySet<>();
     this.deviceToExtractorsCache =
         Caffeine.newBuilder()
             .maximumSize(PipeConfig.getInstance().getPipeExtractorMatcherCacheSize())