You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2021/02/05 02:34:38 UTC

[iotdb] branch FileQueryManagerNPE created (now 41f46ac)

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

jackietien pushed a change to branch FileQueryManagerNPE
in repository https://gitbox.apache.org/repos/asf/iotdb.git.


      at 41f46ac  fix possible NPE during end query process

This branch includes the following new commits:

     new 41f46ac  fix possible NPE during end query process

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 possible NPE during end query process

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

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

commit 41f46ac18386ca39b861f7a142bf31029dfb149e
Author: JackieTien97 <Ja...@foxmail.com>
AuthorDate: Fri Feb 5 10:30:15 2021 +0800

    fix possible NPE during end query process
---
 .../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;
+    });
   }
 
   /**