You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2020/01/09 08:58:55 UTC

[incubator-iotdb] 01/01: change hashmap to concurrenthashmap in QueryContext

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

qiaojialin pushed a commit to branch fix_querycontext_concurrent
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git

commit 01979f22e244061e785f3a6673d0cc22b52e713b
Author: qiaojialin <64...@qq.com>
AuthorDate: Thu Jan 9 16:58:34 2020 +0800

    change hashmap to concurrenthashmap in QueryContext
---
 .../main/java/org/apache/iotdb/db/query/context/QueryContext.java    | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/query/context/QueryContext.java b/server/src/main/java/org/apache/iotdb/db/query/context/QueryContext.java
index 10f6cbc..fe78825 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/context/QueryContext.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/context/QueryContext.java
@@ -23,6 +23,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 import org.apache.iotdb.db.engine.modification.Modification;
 import org.apache.iotdb.db.engine.modification.ModificationFile;
 import org.apache.iotdb.tsfile.file.metadata.ChunkMetaData;
@@ -36,13 +37,13 @@ public class QueryContext {
    * The outer key is the path of a ModificationFile, the inner key in the name of a timeseries and
    * the value is the Modifications of a timeseries in this file.
    */
-  private Map<String, Map<String, List<Modification>>> filePathModCache = new HashMap<>();
+  private Map<String, Map<String, List<Modification>>> filePathModCache = new ConcurrentHashMap<>();
   /**
    * The key is the path of a ModificationFile and the value is all Modifications in this file. We
    * use this field because each call of Modification.getModifications() return a copy of the
    * Modifications, and we do not want it to create multiple copies within a query.
    */
-  private Map<String, List<Modification>> fileModCache = new HashMap<>();
+  private Map<String, List<Modification>> fileModCache = new ConcurrentHashMap<>();
 
   private long queryId;