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

sunzesong 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 17e5216  [To rel/0.11] print more insert error message in client 
(#2381)
17e5216 is described below

commit 17e5216a0160cdb5c32b60743ee1f59f42a0a9ae
Author: Haonan <[email protected]>
AuthorDate: Wed Dec 30 16:51:20 2020 +0800

    [To rel/0.11] print more insert error message in client (#2381)
    
    * print more insert error in client
---
 .../java/org/apache/iotdb/db/qp/executor/PlanExecutor.java   | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java 
b/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
index cfc251c..6e02613 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
@@ -889,6 +889,7 @@ public class PlanExecutor implements IPlanExecutor {
         List<String> failedPaths = insertRowPlan.getFailedMeasurements();
         List<Exception> exceptions = insertRowPlan.getFailedExceptions();
         boolean isPathNotExistException = true;
+        Exception exception = null;
         for (Exception e : exceptions) {
           Throwable curException = e;
           while (curException.getCause() != null) {
@@ -896,6 +897,7 @@ public class PlanExecutor implements IPlanExecutor {
           }
           if (!(curException instanceof PathNotExistException)) {
             isPathNotExistException = false;
+            exception = e;
             break;
           }
         }
@@ -903,7 +905,8 @@ public class PlanExecutor implements IPlanExecutor {
           throw new PathNotExistException(failedPaths);
         } else {
           throw new StorageEngineException(
-              "failed to insert points " + 
insertRowPlan.getFailedMeasurements());
+              "failed to insert points " + 
insertRowPlan.getFailedMeasurements() +
+              ": " + exception.getMessage());
         }
       }
     } catch (StorageEngineException | MetadataException e) {
@@ -926,6 +929,7 @@ public class PlanExecutor implements IPlanExecutor {
 
       List<String> notExistedPaths = null;
       List<String> failedMeasurements = null;
+      Exception exception = null;
        for (InsertRowPlan plan : insertRowsOfOneDevicePlan.getRowPlans()) {
         if (plan.getFailedMeasurements() != null) {
           if (notExistedPaths == null) {
@@ -943,6 +947,7 @@ public class PlanExecutor implements IPlanExecutor {
             }
             if (!(curException instanceof PathNotExistException)) {
               isPathNotExistException = false;
+              exception = e;
               break;
             }
           }
@@ -955,9 +960,10 @@ public class PlanExecutor implements IPlanExecutor {
       }
       if (notExistedPaths != null && !notExistedPaths.isEmpty()) {
         throw new PathNotExistException(notExistedPaths);
-      } else if (notExistedPaths != null && !failedMeasurements.isEmpty()) {
+      } else if (notExistedPaths != null && !failedMeasurements.isEmpty() && 
exception != null) {
         throw new StorageEngineException(
-            "failed to insert points " + failedMeasurements);
+            "failed to insert points " + failedMeasurements +
+            ": " + exception.getMessage());
       }
 
     } catch (StorageEngineException | MetadataException e) {

Reply via email to