From commits-return-10530-archive-asf-public=cust-asf.ponee.io@iotdb.apache.org Sun Nov 1 07:53:00 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mxout1-ec2-va.apache.org (mxout1-ec2-va.apache.org [3.227.148.255]) by mx-eu-01.ponee.io (Postfix) with ESMTPS id 76EA6180674 for ; Sun, 1 Nov 2020 08:53:00 +0100 (CET) Received: from mail.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by mxout1-ec2-va.apache.org (ASF Mail Server at mxout1-ec2-va.apache.org) with SMTP id 9BAA941DFE for ; Sun, 1 Nov 2020 07:52:59 +0000 (UTC) Received: (qmail 56619 invoked by uid 500); 1 Nov 2020 07:52:59 -0000 Mailing-List: contact commits-help@iotdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@iotdb.apache.org Delivered-To: mailing list commits@iotdb.apache.org Received: (qmail 56587 invoked by uid 99); 1 Nov 2020 07:52:59 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 Nov 2020 07:52:59 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id A53358040D; Sun, 1 Nov 2020 07:52:57 +0000 (UTC) Date: Sun, 01 Nov 2020 07:52:57 +0000 To: "commits@iotdb.apache.org" Subject: [iotdb] 01/01: check reasons when insert tablets MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: yuyuankang@apache.org In-Reply-To: <160421717624.1455.12453539010725390166@gitbox.apache.org> References: <160421717624.1455.12453539010725390166@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: iotdb X-Git-Refname: refs/heads/kyy X-Git-Reftype: branch X-Git-Rev: 92b36c34e1811d16eb213de101300474c5859dab X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20201101075258.A53358040D@gitbox.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 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>> storageGroupMap = plan .getStorageGroupPartitionIds(); for (Entry>> 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 failedPaths = insertRowPlan.getFailedMeasurements(); - List 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 failedMeasurements, List 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++) {