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/11/16 02:53:41 UTC
[iotdb] branch rel/0.11 updated: update last cache when show latest timeseries
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 3ce2efa update last cache when show latest timeseries
3ce2efa is described below
commit 3ce2efa301b26b1e84f7496b2e6f3f3098fed14c
Author: qiaojialin <64...@qq.com>
AuthorDate: Tue Nov 16 10:52:59 2021 +0800
update last cache when show latest timeseries
---
server/src/main/java/org/apache/iotdb/db/metadata/MTree.java | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/MTree.java b/server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
index e86c8a0..02bcc1d 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
@@ -83,6 +83,8 @@ import org.slf4j.LoggerFactory;
/** The hierarchical struct of the Metadata Tree is implemented in this class. */
public class MTree implements Serializable {
+ private static final boolean CACHE_ENABLED =
+ IoTDBDescriptor.getInstance().getConfig().isLastCacheEnabled();
public static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
private static final long serialVersionUID = -4200394435237291964L;
private static final Logger logger = LoggerFactory.getLogger(MTree.class);
@@ -113,6 +115,9 @@ public class MTree implements Serializable {
node.getSchema().getType(), Collections.emptySet(), queryContext,
dataSource, Long.MAX_VALUE, null);
last = lastReader.readLastPoint();
+ if (CACHE_ENABLED && last != null && last.getValue() != null) {
+ node.updateCachedLast(last, false, Long.MIN_VALUE);
+ }
return (last != null ? last.getTimestamp() : Long.MIN_VALUE);
} catch (Exception e) {
logger.error("Something wrong happened while trying to get last time value pair of {}",