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 2021/02/05 06:18:37 UTC

[iotdb] branch rel/0.11 updated: fix possible NPE during end query process (#2633)

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

qiaojialin pushed a commit to branch rel/0.11
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/rel/0.11 by this push:
     new 607a602  fix possible NPE during end query process (#2633)
607a602 is described below

commit 607a60286d04b526d1d343fe7147118bc1fd91ab
Author: Jackie Tien <Ja...@foxmail.com>
AuthorDate: Fri Feb 5 14:18:16 2021 +0800

    fix possible NPE during end query process (#2633)
---
 .../iotdb/db/query/control/QueryFileManager.java     | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/query/control/QueryFileManager.java b/server/src/main/java/org/apache/iotdb/db/query/control/QueryFileManager.java
index b781305..893308f 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/control/QueryFileManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/control/QueryFileManager.java
@@ -91,20 +91,18 @@ public class QueryFileManager {
    * this jdbc request must be cleared and thus the usage reference must be decreased.
    */
   void removeUsedFilesForQuery(long queryId) {
-    Set<TsFileResource> tsFiles = sealedFilePathsMap.get(queryId);
-    if (tsFiles != null) {
-      for (TsFileResource tsFile : sealedFilePathsMap.get(queryId)) {
+    sealedFilePathsMap.computeIfPresent(queryId, (k, v) -> {
+      for (TsFileResource tsFile : v) {
         FileReaderManager.getInstance().decreaseFileReaderReference(tsFile, true);
       }
-      sealedFilePathsMap.remove(queryId);
-    }
-    tsFiles = unsealedFilePathsMap.get(queryId);
-    if (tsFiles != null) {
-      for (TsFileResource tsFile : unsealedFilePathsMap.get(queryId)) {
-        FileReaderManager.getInstance().decreaseFileReaderReference(tsFile, false);
+      return null;
+    });
+    unsealedFilePathsMap.computeIfPresent(queryId, (k, v) -> {
+      for (TsFileResource tsFile : v) {
+        FileReaderManager.getInstance().decreaseFileReaderReference(tsFile, true);
       }
-      unsealedFilePathsMap.remove(queryId);
-    }
+      return null;
+    });
   }
 
   /**