You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ma...@apache.org on 2023/06/02 03:50:31 UTC

[iotdb] branch fix-concurrent-modification created (now 9cf74f2a19b)

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

marklau99 pushed a change to branch fix-concurrent-modification
in repository https://gitbox.apache.org/repos/asf/iotdb.git


      at 9cf74f2a19b Fix ConcurrentModificationException in updating FileMetrics (#10022)

This branch includes the following new commits:

     new 9cf74f2a19b Fix ConcurrentModificationException in updating FileMetrics (#10022)

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[iotdb] 01/01: Fix ConcurrentModificationException in updating FileMetrics (#10022)

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 9cf74f2a19ba2482e4c7c67ed243432e3a06404c
Author: Liu Xuxin <37...@users.noreply.github.com>
AuthorDate: Thu Jun 1 23:54:40 2023 +0800

    Fix ConcurrentModificationException in updating FileMetrics (#10022)
---
 .../java/org/apache/iotdb/db/service/metrics/FileMetrics.java    | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/service/metrics/FileMetrics.java b/server/src/main/java/org/apache/iotdb/db/service/metrics/FileMetrics.java
index 110b3ed559d..1b82f2a512d 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/metrics/FileMetrics.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/metrics/FileMetrics.java
@@ -44,7 +44,6 @@ import java.io.BufferedReader;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStreamReader;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
@@ -89,10 +88,10 @@ public class FileMetrics implements IMetricSet {
   private final AtomicInteger innerUnseqCompactionTempFileNum = new AtomicInteger(0);
   private final AtomicInteger crossCompactionTempFileNum = new AtomicInteger(0);
   private AtomicBoolean hasRemainData = new AtomicBoolean(false);
-  private final Map<Integer, Gauge> seqLevelCountGaugeMap = new HashMap<>();
-  private final Map<Integer, Gauge> seqLevelSizeGaugeMap = new HashMap<>();
-  private final Map<Integer, Gauge> unseqLevelCountGaugeMap = new HashMap<>();
-  private final Map<Integer, Gauge> unseqLevelSizeGaugeMap = new HashMap<>();
+  private final Map<Integer, Gauge> seqLevelCountGaugeMap = new ConcurrentHashMap<>();
+  private final Map<Integer, Gauge> seqLevelSizeGaugeMap = new ConcurrentHashMap<>();
+  private final Map<Integer, Gauge> unseqLevelCountGaugeMap = new ConcurrentHashMap<>();
+  private final Map<Integer, Gauge> unseqLevelSizeGaugeMap = new ConcurrentHashMap<>();
 
   @SuppressWarnings("squid:S1075")
   private String fileHandlerCntPathInLinux = "/proc/%s/fd";