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/11/16 02:18:11 UTC

[iotdb] 01/01: Update last cache while doing show latest timeseries query

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

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

commit 9cbf79bf9ec5cae4c9318485e4050f6e68fbc42e
Author: JackieTien97 <Ja...@foxmail.com>
AuthorDate: Tue Nov 16 10:17:28 2021 +0800

    Update last cache while doing show latest timeseries query
---
 .../org/apache/iotdb/db/metadata/lastCache/LastCacheManager.java   | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/lastCache/LastCacheManager.java b/server/src/main/java/org/apache/iotdb/db/metadata/lastCache/LastCacheManager.java
index 0662ef1..8af8a7b 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/lastCache/LastCacheManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/lastCache/LastCacheManager.java
@@ -19,6 +19,7 @@
 
 package org.apache.iotdb.db.metadata.lastCache;
 
+import org.apache.iotdb.db.conf.IoTDBDescriptor;
 import org.apache.iotdb.db.engine.querycontext.QueryDataSource;
 import org.apache.iotdb.db.metadata.PartialPath;
 import org.apache.iotdb.db.metadata.VectorPartialPath;
@@ -47,6 +48,9 @@ public class LastCacheManager {
 
   private static final Logger logger = LoggerFactory.getLogger(LastCacheManager.class);
 
+  private static final boolean CACHE_ENABLED =
+      IoTDBDescriptor.getInstance().getConfig().isLastCacheEnabled();
+
   /**
    * get the last cache value of time series of given seriesPath
    *
@@ -325,6 +329,9 @@ public class LastCacheManager {
                 Long.MAX_VALUE,
                 null);
         last = lastReader.readLastPoint();
+        if (CACHE_ENABLED && last != null && last.getValue() != null) {
+          updateLastCache(node.getPartialPath(), last, false, Long.MIN_VALUE, node);
+        }
         return (last != null ? last.getTimestamp() : Long.MIN_VALUE);
       } catch (Exception e) {
         logger.error(