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 03:59:27 UTC
[iotdb] 01/01: path check of tablets
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 d00fddf25bebb0e87c6f5e06cee796e93fb86046
Author: Ring-k <yu...@hotmail.com>
AuthorDate: Sun Nov 1 11:57:59 2020 +0800
path check of tablets
---
.../apache/iotdb/db/qp/executor/PlanExecutor.java | 40 ++++++++++++++++++----
1 file changed, 33 insertions(+), 7 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..999cff5 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(
@@ -965,11 +968,33 @@ public class PlanExecutor implements IPlanExecutor {
try {
insertTabletPlan
.setMeasurementMNodes(new MeasurementMNode[insertTabletPlan.getMeasurements().length]);
- getSeriesSchemas(insertTabletPlan);
+ MNode deviceNode = getSeriesSchemas(insertTabletPlan);
+ if (deviceNode == null) {
+ // TODO mark all measurements to be failed
+ logger.info("device id does not exist");
+ }
StorageEngine.getInstance().insertTablet(insertTabletPlan);
if (insertTabletPlan.getFailedMeasurements() != null) {
- throw new StorageEngineException(
- INSERT_MEASUREMENTS_FAILED_MESSAGE + insertTabletPlan.getFailedMeasurements());
+ // check if all path not exist exceptions
+ List<String> failedPaths = insertTabletPlan.getFailedMeasurements();
+ List<Exception> exceptions = insertTabletPlan.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 + insertTabletPlan.getFailedMeasurements());
+ }
}
} catch (StorageEngineException | MetadataException e) {
throw new QueryProcessException(e);
@@ -1058,7 +1083,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++) {