You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by zy...@apache.org on 2023/02/08 06:47:04 UTC

[iotdb] branch master updated: [IOTDB-5499] Eliminate useless log during auto creating schema (#9013)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 0a68bb7f39 [IOTDB-5499] Eliminate useless log during auto creating schema (#9013)
0a68bb7f39 is described below

commit 0a68bb7f39d3625b54c75d66700ca0a30b843ca3
Author: Marcos_Zyk <38...@users.noreply.github.com>
AuthorDate: Wed Feb 8 14:46:58 2023 +0800

    [IOTDB-5499] Eliminate useless log during auto creating schema (#9013)
---
 .../metadata/visitor/SchemaExecutionVisitor.java   |  8 ++++----
 .../execution/executor/RegionWriteExecutor.java    | 22 ++++++++++------------
 .../scheduler/FragmentInstanceDispatcherImpl.java  | 12 ++++++++++++
 3 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/visitor/SchemaExecutionVisitor.java b/server/src/main/java/org/apache/iotdb/db/metadata/visitor/SchemaExecutionVisitor.java
index d69597fca8..d553b049a0 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/visitor/SchemaExecutionVisitor.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/visitor/SchemaExecutionVisitor.java
@@ -213,12 +213,12 @@ public class SchemaExecutionVisitor extends PlanVisitor<TSStatus, ISchemaRegion>
         schemaRegion.createTimeseries(
             transformToCreateTimeSeriesPlan(devicePath, measurementGroup, i), -1);
       } catch (MeasurementAlreadyExistException e) {
-        logger.info("There's no need to internal create timeseries. {}", e.getMessage());
+        // There's no need to internal create timeseries.
         alreadyExistingTimeseries.add(
             RpcUtils.getStatus(
                 e.getErrorCode(), MeasurementPath.transformDataToString(e.getMeasurementPath())));
       } catch (MetadataException e) {
-        logger.error("{}: MetaData error: ", IoTDBConstant.GLOBAL_DB_NAME, e);
+        logger.warn("{}: MetaData error: ", e.getMessage(), e);
         failingStatus.add(RpcUtils.getStatus(e.getErrorCode(), e.getMessage()));
       }
     }
@@ -252,7 +252,7 @@ public class SchemaExecutionVisitor extends PlanVisitor<TSStatus, ISchemaRegion>
         shouldRetry = false;
       } catch (MeasurementAlreadyExistException e) {
         // the existence check will be executed before truly creation
-        logger.info("There's no need to internal create timeseries. {}", e.getMessage());
+        // There's no need to internal create timeseries.
         MeasurementPath measurementPath = e.getMeasurementPath();
         alreadyExistingTimeseries.add(
             RpcUtils.getStatus(
@@ -270,7 +270,7 @@ public class SchemaExecutionVisitor extends PlanVisitor<TSStatus, ISchemaRegion>
         }
 
       } catch (MetadataException e) {
-        logger.error("{}: MetaData error: ", IoTDBConstant.GLOBAL_DB_NAME, e);
+        logger.warn("{}: MetaData error: ", e.getMessage(), e);
         failingStatus.add(RpcUtils.getStatus(e.getErrorCode(), e.getMessage()));
         shouldRetry = false;
       }
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/executor/RegionWriteExecutor.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/executor/RegionWriteExecutor.java
index b237707483..1b12041024 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/executor/RegionWriteExecutor.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/executor/RegionWriteExecutor.java
@@ -432,9 +432,7 @@ public class RegionWriteExecutor {
             metadataException = failingMeasurement.getValue();
             if (metadataException.getErrorCode()
                 == TSStatusCode.TIMESERIES_ALREADY_EXIST.getStatusCode()) {
-              LOGGER.info(
-                  "There's no need to internal create timeseries. {}",
-                  failingMeasurement.getValue().getMessage());
+              // There's no need to internal create timeseries.
               alreadyExistingStatus.add(
                   RpcUtils.getStatus(
                       metadataException.getErrorCode(),
@@ -442,7 +440,7 @@ public class RegionWriteExecutor {
                           ((MeasurementAlreadyExistException) metadataException)
                               .getMeasurementPath())));
             } else {
-              LOGGER.error("Metadata error: ", metadataException);
+              LOGGER.warn("Metadata error: ", metadataException);
               failingStatus.add(
                   RpcUtils.getStatus(
                       metadataException.getErrorCode(), metadataException.getMessage()));
@@ -484,15 +482,16 @@ public class RegionWriteExecutor {
             }
           }
 
+          RegionExecutionResult result = new RegionExecutionResult();
           TSStatus status;
           if (failingStatus.isEmpty()) {
             status = RpcUtils.getStatus(alreadyExistingStatus);
+            result.setAccepted(true);
           } else {
             status = RpcUtils.getStatus(failingStatus);
+            result.setAccepted(false);
           }
 
-          RegionExecutionResult result = new RegionExecutionResult();
-          result.setAccepted(false);
           result.setMessage(status.getMessage());
           result.setStatus(status);
           return result;
@@ -532,9 +531,7 @@ public class RegionWriteExecutor {
               metadataException = failingMeasurement.getValue();
               if (metadataException.getErrorCode()
                   == TSStatusCode.TIMESERIES_ALREADY_EXIST.getStatusCode()) {
-                LOGGER.info(
-                    "There's no need to internal create timeseries. {}",
-                    failingMeasurement.getValue().getMessage());
+                // There's no need to internal create timeseries.
                 alreadyExistingStatus.add(
                     RpcUtils.getStatus(
                         metadataException.getErrorCode(),
@@ -542,7 +539,7 @@ public class RegionWriteExecutor {
                             ((MeasurementAlreadyExistException) metadataException)
                                 .getMeasurementPath())));
               } else {
-                LOGGER.error("Metadata error: ", metadataException);
+                LOGGER.warn("Metadata error: ", metadataException);
                 failingStatus.add(
                     RpcUtils.getStatus(
                         metadataException.getErrorCode(), metadataException.getMessage()));
@@ -585,15 +582,16 @@ public class RegionWriteExecutor {
             }
           }
 
+          RegionExecutionResult result = new RegionExecutionResult();
           TSStatus status;
           if (failingStatus.isEmpty()) {
             status = RpcUtils.getStatus(alreadyExistingStatus);
+            result.setAccepted(true);
           } else {
             status = RpcUtils.getStatus(failingStatus);
+            result.setAccepted(false);
           }
 
-          RegionExecutionResult result = new RegionExecutionResult();
-          result.setAccepted(false);
           result.setMessage(status.getMessage());
           result.setStatus(status);
           return result;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/FragmentInstanceDispatcherImpl.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/FragmentInstanceDispatcherImpl.java
index f299d862e9..0007d17f18 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/FragmentInstanceDispatcherImpl.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/FragmentInstanceDispatcherImpl.java
@@ -209,6 +209,12 @@ public class FragmentInstanceDispatcherImpl implements IFragInstanceDispatcher {
             } else {
               throw new FragmentInstanceDispatchException(sendPlanNodeResp.getStatus());
             }
+          } else {
+            // some expected and accepted status except SUCCESS_STATUS need to be returned
+            TSStatus status = sendPlanNodeResp.getStatus();
+            if (status != null && status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
+              throw new FragmentInstanceDispatchException(status);
+            }
           }
           break;
         default:
@@ -274,6 +280,12 @@ public class FragmentInstanceDispatcherImpl implements IFragInstanceDispatcher {
           } else {
             throw new FragmentInstanceDispatchException(writeResult.getStatus());
           }
+        } else {
+          // some expected and accepted status except SUCCESS_STATUS need to be returned
+          TSStatus status = writeResult.getStatus();
+          if (status != null && status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
+            throw new FragmentInstanceDispatchException(status);
+          }
         }
         break;
       default: