You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by yu...@apache.org on 2020/11/01 07:52:56 UTC

[iotdb] branch kyy created (now 92b36c3)

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

yuyuankang pushed a change to branch kyy
in repository https://gitbox.apache.org/repos/asf/iotdb.git.


      at 92b36c3  check reasons when insert tablets

This branch includes the following new commits:

     new 92b36c3  check reasons when insert tablets

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[iotdb] 01/01: check reasons when insert tablets

Posted by yu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 92b36c34e1811d16eb213de101300474c5859dab
Author: Ring-k <yu...@hotmail.com>
AuthorDate: Sun Nov 1 15:51:48 2020 +0800

    check reasons when insert tablets
---
 .../apache/iotdb/db/qp/executor/PlanExecutor.java  | 66 ++++++++++++----------
 1 file changed, 36 insertions(+), 30 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 606ad35..d78f9a6 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
@@ -324,7 +324,8 @@ public class PlanExecutor implements IPlanExecutor {
     }
   }
 
-  public static void flushSpecifiedStorageGroups(FlushPlan plan) throws StorageGroupNotSetException {
+  public static void flushSpecifiedStorageGroups(FlushPlan plan)
+      throws StorageGroupNotSetException {
     Map<PartialPath, List<Pair<Long, Boolean>>> storageGroupMap = plan
         .getStorageGroupPartitionIds();
     for (Entry<PartialPath, List<Pair<Long, Boolean>>> entry : storageGroupMap.entrySet()) {
@@ -734,7 +735,8 @@ public class PlanExecutor implements IPlanExecutor {
   @Override
   public void delete(DeletePlan deletePlan) throws QueryProcessException {
     for (PartialPath path : deletePlan.getPaths()) {
-      delete(path, deletePlan.getDeleteStartTime(), deletePlan.getDeleteEndTime(), deletePlan.getIndex());
+      delete(path, deletePlan.getDeleteStartTime(), deletePlan.getDeleteEndTime(),
+          deletePlan.getIndex());
     }
   }
 
@@ -900,7 +902,8 @@ public class PlanExecutor implements IPlanExecutor {
   }
 
   @Override
-  public void delete(PartialPath path, long startTime, long endTime, long planIndex) throws QueryProcessException {
+  public void delete(PartialPath path, long startTime, long endTime, long planIndex)
+      throws QueryProcessException {
     try {
       if (!IoTDB.metaManager.isPathExist(path)) {
         throw new QueryProcessException(
@@ -933,28 +936,8 @@ public class PlanExecutor implements IPlanExecutor {
       }
 
       StorageEngine.getInstance().insert(insertRowPlan);
-      if (insertRowPlan.getFailedMeasurements() != null) {
-        // check if all path not exist exceptions
-        List<String> failedPaths = insertRowPlan.getFailedMeasurements();
-        List<Exception> exceptions = insertRowPlan.getFailedExceptions();
-        boolean isPathNotExistException = true;
-        for (Exception e : exceptions) {
-          Throwable curException = e;
-          while (curException.getCause() != null) {
-            curException = curException.getCause();
-          }
-          if (!(curException instanceof PathNotExistException)) {
-            isPathNotExistException = false;
-            break;
-          }
-        }
-        if (isPathNotExistException) {
-          throw new PathNotExistException(failedPaths);
-        } else {
-          throw new StorageEngineException(
-              INSERT_MEASUREMENTS_FAILED_MESSAGE + insertRowPlan.getFailedMeasurements());
-        }
-      }
+      checkFailedReasons(insertRowPlan.getFailedMeasurements(),
+          insertRowPlan.getFailedExceptions());
     } catch (StorageEngineException | MetadataException e) {
       throw new QueryProcessException(e);
     }
@@ -967,15 +950,37 @@ public class PlanExecutor implements IPlanExecutor {
           .setMeasurementMNodes(new MeasurementMNode[insertTabletPlan.getMeasurements().length]);
       getSeriesSchemas(insertTabletPlan);
       StorageEngine.getInstance().insertTablet(insertTabletPlan);
-      if (insertTabletPlan.getFailedMeasurements() != null) {
-        throw new StorageEngineException(
-            INSERT_MEASUREMENTS_FAILED_MESSAGE + insertTabletPlan.getFailedMeasurements());
-      }
+      checkFailedReasons(insertTabletPlan.getFailedMeasurements(),
+          insertTabletPlan.getFailedExceptions());
     } catch (StorageEngineException | MetadataException e) {
       throw new QueryProcessException(e);
     }
   }
 
+  private void checkFailedReasons(List<String> failedMeasurements, List<Exception> failedExceptions)
+      throws PathNotExistException, StorageEngineException {
+    if (failedMeasurements != null) {
+      // check if all path not exist exceptions
+      boolean isPathNotExistException = true;
+      for (Exception e : failedExceptions) {
+        Throwable curException = e;
+        while (curException.getCause() != null) {
+          curException = curException.getCause();
+        }
+        if (!(curException instanceof PathNotExistException)) {
+          isPathNotExistException = false;
+          break;
+        }
+      }
+      if (isPathNotExistException) {
+        throw new PathNotExistException(failedMeasurements);
+      } else {
+        throw new StorageEngineException(
+            INSERT_MEASUREMENTS_FAILED_MESSAGE + failedMeasurements);
+      }
+    }
+  }
+
   private boolean operateAuthor(AuthorPlan author) throws QueryProcessException {
     AuthorOperator.AuthorType authorType = author.getAuthorType();
     String userName = author.getUserName();
@@ -1058,7 +1063,8 @@ public class PlanExecutor implements IPlanExecutor {
     return true;
   }
 
-  private boolean createMultiTimeSeries(CreateMultiTimeSeriesPlan createMultiTimeSeriesPlan) throws QueryProcessException {
+  private boolean createMultiTimeSeries(CreateMultiTimeSeriesPlan createMultiTimeSeriesPlan)
+      throws QueryProcessException {
     TSStatus[] results = null;
     boolean hasFailed = false;
     for (int i = 0; i < createMultiTimeSeriesPlan.getPaths().size(); i++) {