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/03/11 12:33:59 UTC

[iotdb] branch NoDeviceBug created (now 1bfcc3f)

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

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


      at 1bfcc3f  fix bug

This branch includes the following new commits:

     new 1bfcc3f  fix bug

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 bug

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

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

commit 1bfcc3fea2a86d90cb7942b0e76f86e89edcbe37
Author: JackieTien97 <Ja...@foxmail.com>
AuthorDate: Thu Mar 11 20:33:21 2021 +0800

    fix bug
---
 .../db/engine/cache/TimeSeriesMetadataCache.java   | 31 ++++++++++++----------
 1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java b/server/src/main/java/org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java
index d6ad1f4..580755d 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java
@@ -183,21 +183,24 @@ public class TimeSeriesMetadataCache {
           List<TimeseriesMetadata> timeSeriesMetadataList =
               reader.readTimeseriesMetadata(path, allSensors);
           // put TimeSeriesMetadata of all sensors used in this query into cache
-          lock.writeLock().lock();
-          try {
-            timeSeriesMetadataList.forEach(
-                metadata -> {
-                  TimeSeriesMetadataCacheKey k =
-                      new TimeSeriesMetadataCacheKey(
-                          key.filePath, key.device, metadata.getMeasurementId());
-                  if (!lruCache.containsKey(k)) {
-                    lruCache.put(k, metadata);
-                  }
-                });
-            timeseriesMetadata = lruCache.get(key);
-          } finally {
-            lock.writeLock().unlock();
+          if (timeSeriesMetadataList != null) {
+            lock.writeLock().lock();
+            try {
+              timeSeriesMetadataList.forEach(
+                  metadata -> {
+                    TimeSeriesMetadataCacheKey k =
+                        new TimeSeriesMetadataCacheKey(
+                            key.filePath, key.device, metadata.getMeasurementId());
+                    if (!lruCache.containsKey(k)) {
+                      lruCache.put(k, metadata);
+                    }
+                  });
+              timeseriesMetadata = lruCache.get(key);
+            } finally {
+              lock.writeLock().unlock();
+            }
           }
+
         }
       }
     }