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 2024/04/24 11:59:17 UTC

(iotdb) 01/01: Change log level and opt error msg for source path of view is deleted

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

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

commit 4125972b5a8b40f4eb0361b10262076b6a73189b
Author: JackieTien97 <ja...@gmail.com>
AuthorDate: Wed Apr 24 19:59:01 2024 +0800

    Change log level and opt error msg for source path of view is deleted
---
 .../src/assembly/resources/conf/logback-datanode.xml      | 15 ---------------
 .../db/exception/metadata/view/BrokenViewException.java   | 13 +++++--------
 .../execution/executor/RegionWriteExecutor.java           | 12 ++++++------
 .../visitor/CompleteMeasurementSchemaVisitor.java         |  6 +++++-
 4 files changed, 16 insertions(+), 30 deletions(-)

diff --git a/iotdb-core/datanode/src/assembly/resources/conf/logback-datanode.xml b/iotdb-core/datanode/src/assembly/resources/conf/logback-datanode.xml
index 4836791625f..698bdfc3a82 100644
--- a/iotdb-core/datanode/src/assembly/resources/conf/logback-datanode.xml
+++ b/iotdb-core/datanode/src/assembly/resources/conf/logback-datanode.xml
@@ -177,21 +177,6 @@
             <level>INFO</level>
         </filter>
     </appender>
-    <appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="QUERY_FREQUENCY">
-        <file>${IOTDB_HOME}/logs/log_datanode_query_frequency.log</file>
-        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-            <fileNamePattern>${IOTDB_HOME}/logs/log-datanode-query-frequency-%d{yyyyMMdd}.log.gz</fileNamePattern>
-            <maxHistory>30</maxHistory>
-        </rollingPolicy>
-        <append>true</append>
-        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
-            <pattern>%d [%t] %-5p %C{25}:%L - %m %n</pattern>
-            <charset>utf-8</charset>
-        </encoder>
-        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
-            <level>INFO</level>
-        </filter>
-    </appender>
     <appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="COMPACTION">
         <file>${IOTDB_HOME}/logs/log_datanode_compaction.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/BrokenViewException.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/BrokenViewException.java
index e74e925eea9..fe7eccb8dbd 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/BrokenViewException.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/BrokenViewException.java
@@ -21,22 +21,19 @@ package org.apache.iotdb.db.exception.metadata.view;
 
 import org.apache.iotdb.commons.exception.MetadataException;
 import org.apache.iotdb.commons.path.MeasurementPath;
-import org.apache.iotdb.commons.path.PartialPath;
 
 import java.util.List;
 
 public class BrokenViewException extends MetadataException {
+
+  public BrokenViewException(String sourcePath) {
+    super(String.format("The source path [%s] is deleted", sourcePath));
+  }
+
   public BrokenViewException(String sourcePath, List<MeasurementPath> matchedPaths) {
     super(
         String.format(
             "View is broken! The source path [%s] maps to unmatched %s path(s): %s.",
             sourcePath, matchedPaths.size(), matchedPaths));
   }
-
-  public BrokenViewException(String viewPath, String sourcePath, List<PartialPath> matchedPaths) {
-    super(
-        String.format(
-            "View [%s] is broken! The source path [%s] maps to unmatched %s path(s): %s.",
-            viewPath, sourcePath, matchedPaths.size(), matchedPaths));
-  }
 }
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/executor/RegionWriteExecutor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/executor/RegionWriteExecutor.java
index 7d8ddec7ba7..41dc339c23d 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/executor/RegionWriteExecutor.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/executor/RegionWriteExecutor.java
@@ -146,7 +146,7 @@ public class RegionWriteExecutor {
           new WritePlanNodeExecutionContext(groupId, regionManager.getRegionLock(groupId));
       return planNode.accept(executionVisitor, context);
     } catch (Throwable e) {
-      LOGGER.error(e.getMessage(), e);
+      LOGGER.warn(e.getMessage(), e);
       RegionExecutionResult result = new RegionExecutionResult();
       result.setAccepted(false);
       result.setMessage(e.getMessage());
@@ -178,7 +178,7 @@ public class RegionWriteExecutor {
         response.setMessage(status.getMessage());
         response.setStatus(status);
       } catch (ConsensusException e) {
-        LOGGER.error("Failed in the write API executing the consensus layer due to: ", e);
+        LOGGER.warn("Failed in the write API executing the consensus layer due to: ", e);
         response.setAccepted(false);
         response.setMessage(e.toString());
         response.setStatus(
@@ -346,7 +346,7 @@ public class RegionWriteExecutor {
                 : super.visitCreateTimeSeries(node, context);
           } else {
             MetadataException metadataException = failingMeasurementMap.get(0);
-            LOGGER.error(METADATA_ERROR_MSG, metadataException);
+            LOGGER.warn(METADATA_ERROR_MSG, metadataException);
             result = new RegionExecutionResult();
             result.setAccepted(false);
             result.setMessage(metadataException.getMessage());
@@ -395,7 +395,7 @@ public class RegionWriteExecutor {
                 : super.visitCreateAlignedTimeSeries(node, context);
           } else {
             MetadataException metadataException = failingMeasurementMap.values().iterator().next();
-            LOGGER.error(METADATA_ERROR_MSG, metadataException);
+            LOGGER.warn(METADATA_ERROR_MSG, metadataException);
             result = new RegionExecutionResult();
             result.setAccepted(false);
             result.setMessage(metadataException.getMessage());
@@ -491,7 +491,7 @@ public class RegionWriteExecutor {
 
         for (Map.Entry<Integer, MetadataException> failingMeasurement :
             failingMeasurementMap.entrySet()) {
-          LOGGER.error(METADATA_ERROR_MSG, failingMeasurement.getValue());
+          LOGGER.warn(METADATA_ERROR_MSG, failingMeasurement.getValue());
           failingStatus.add(
               RpcUtils.getStatus(
                   failingMeasurement.getValue().getErrorCode(),
@@ -962,7 +962,7 @@ public class RegionWriteExecutor {
           // if there are some exceptions, handle each exception and return first of them.
           if (!failingMetadataException.isEmpty()) {
             MetadataException metadataException = failingMetadataException.get(0);
-            LOGGER.error(METADATA_ERROR_MSG, metadataException);
+            LOGGER.warn(METADATA_ERROR_MSG, metadataException);
             RegionExecutionResult result = new RegionExecutionResult();
             result.setAccepted(false);
             result.setMessage(metadataException.getMessage());
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/CompleteMeasurementSchemaVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/CompleteMeasurementSchemaVisitor.java
index 5e24366b8c5..f8bb7b8dbe7 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/CompleteMeasurementSchemaVisitor.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/CompleteMeasurementSchemaVisitor.java
@@ -95,7 +95,11 @@ public class CompleteMeasurementSchemaVisitor extends ExpressionVisitor<Expressi
     } catch (Exception notAMeasurementPath) {
       List<MeasurementPath> actualPaths = schemaTree.searchMeasurementPaths(path).left;
       if (actualPaths.size() != 1) {
-        throw new SemanticException(new BrokenViewException(path.getFullPath(), actualPaths));
+        if (actualPaths.isEmpty()) {
+          throw new SemanticException(new BrokenViewException(path.getFullPath()));
+        } else {
+          throw new SemanticException(new BrokenViewException(path.getFullPath(), actualPaths));
+        }
       }
       return new TimeSeriesOperand(actualPaths.get(0));
     }