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/21 10:44:28 UTC

[iotdb] branch rel/0.11 updated: [To rel/0.11] Print last cache log when debug mode is on (#2880)

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

jackietien 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 8f4ff36  [To rel/0.11] Print last cache log when debug mode is on (#2880)
8f4ff36 is described below

commit 8f4ff3603aec7ac24c19282eb7bfbc7656ce8c75
Author: wshao08 <59...@users.noreply.github.com>
AuthorDate: Sun Mar 21 18:43:57 2021 +0800

    [To rel/0.11] Print last cache log when debug mode is on (#2880)
    
    Print last cache log when debug mode is on (#2880)
---
 .../iotdb/db/query/executor/LastQueryExecutor.java    | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/query/executor/LastQueryExecutor.java b/server/src/main/java/org/apache/iotdb/db/query/executor/LastQueryExecutor.java
index 7360a18..8821cf5 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/executor/LastQueryExecutor.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/executor/LastQueryExecutor.java
@@ -133,7 +133,7 @@ public class LastQueryExecutor {
     List<TSDataType> restDataTypes = new ArrayList<>();
     List<PartialPath> restPaths = new ArrayList<>();
     List<Pair<Boolean, TimeValuePair>> resultContainer =
-            readLastPairsFromCache(seriesPaths, dataTypes, filter, cacheAccessors, restPaths, restDataTypes);
+            readLastPairsFromCache(seriesPaths, dataTypes, filter, cacheAccessors, restPaths, restDataTypes, lastQueryPlan.isDebug());
     // If any '>' or '>=' filters are specified, only access cache to get Last result.
     if (filter != null || restPaths.isEmpty()) {
       return resultContainer;
@@ -162,7 +162,13 @@ public class LastQueryExecutor {
           resultContainer.get(i).left = true;
           if (lastCacheEnabled) {
             cacheAccessors.get(i).write(resultContainer.get(i).right);
-            DEBUG_LOGGER.info("[LastQueryExecutor] Update last cache for path: " + seriesPaths + " with timestamp: " + resultContainer.get(i).right.getTimestamp());
+            if (lastQueryPlan.isDebug()) {
+              DEBUG_LOGGER.info(
+                  "[LastQueryExecutor] Update last cache for path: "
+                      + seriesPaths
+                      + " with timestamp: "
+                      + resultContainer.get(i).right.getTimestamp());
+            }
           }
         }
       }
@@ -173,7 +179,7 @@ public class LastQueryExecutor {
   private static List<Pair<Boolean, TimeValuePair>> readLastPairsFromCache(
       List<PartialPath> seriesPaths, List<TSDataType> dataTypes, Filter filter,
       List<LastCacheAccessor> cacheAccessors,
-      List<PartialPath> restPaths, List<TSDataType> restDataTypes) {
+      List<PartialPath> restPaths, List<TSDataType> restDataTypes, boolean isDebug) {
     List<Pair<Boolean, TimeValuePair>> resultContainer = new ArrayList<>();
     if (lastCacheEnabled) {
       for (PartialPath path : seriesPaths) {
@@ -187,7 +193,12 @@ public class LastQueryExecutor {
       TimeValuePair tvPair = cacheAccessors.get(i).read();
       if (tvPair != null) {
         resultContainer.add(new Pair<>(true, tvPair));
-        DEBUG_LOGGER.info("[LastQueryExecutor] Last cache hit for path: {} with timestamp: {}" , seriesPaths.get(i), tvPair.getTimestamp());
+        if (isDebug) {
+          DEBUG_LOGGER.info(
+              "[LastQueryExecutor] Last cache hit for path: {} with timestamp: {}",
+              seriesPaths.get(i),
+              tvPair.getTimestamp());
+        }
       } else {
         resultContainer.add(new Pair<>(false, null));
         restPaths.add(seriesPaths.get(i));