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


The following commit(s) were added to refs/heads/kyy by this push:
     new a98e114  stand alone return error
a98e114 is described below

commit a98e114c561c260b641f27fbb2477e594d6bf879
Author: Ring-k <[email protected]>
AuthorDate: Wed Oct 14 14:30:31 2020 +0800

    stand alone return error
---
 .../src/main/java/org/apache/iotdb/db/metadata/MManager.java  |  4 ++++
 .../java/org/apache/iotdb/db/qp/executor/PlanExecutor.java    | 11 ++++++++++-
 .../main/java/org/apache/iotdb/db/service/TSServiceImpl.java  |  6 +++++-
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java 
b/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
index 8a8a211..3b4b74a 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
@@ -26,6 +26,7 @@ import java.io.File;
 import java.io.FileReader;
 import java.io.IOException;
 import java.nio.file.Files;
+import java.nio.file.Path;
 import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -451,6 +452,9 @@ public class MManager {
     }
     try {
       List<PartialPath> allTimeseries = mtree.getAllTimeseriesPath(prefixPath);
+      if(allTimeseries.isEmpty()){
+        throw new PathNotExistException(prefixPath.getFullPath());
+      }
       // Monitor storage group seriesPath is not allowed to be deleted
       allTimeseries.removeIf(p -> 
p.startsWith(MonitorConstants.getStatStorageGroupPrefixArray()));
 
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 7833d6a..fe8da77 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
@@ -1069,13 +1069,22 @@ public class PlanExecutor implements IPlanExecutor {
     List<PartialPath> deletePathList = deleteTimeSeriesPlan.getPaths();
     try {
       List<String> failedNames = new LinkedList<>();
+      List<String> nonExistPaths = new ArrayList<>();
       for (PartialPath path : deletePathList) {
+        String failedTimeseries = "";
         StorageEngine.getInstance().deleteTimeseries(path.getDevicePath(), 
path.getMeasurement());
-        String failedTimeseries = IoTDB.metaManager.deleteTimeseries(path);
+        try {
+          failedTimeseries = IoTDB.metaManager.deleteTimeseries(path);
+        }catch (PathNotExistException e){
+          nonExistPaths.add(path.getFullPath());
+        }
         if (!failedTimeseries.isEmpty()) {
           failedNames.add(failedTimeseries);
         }
       }
+      if(!nonExistPaths.isEmpty()){
+        throw new PathNotExistException(nonExistPaths);
+      }
       if (!failedNames.isEmpty()) {
         throw new DeleteFailedException(String.join(",", failedNames));
       }
diff --git 
a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java 
b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
index 92e3570..9d8ddad 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
@@ -1640,7 +1640,11 @@ public class TSServiceImpl implements TSIService.Iface, 
ServerContext {
       return RpcUtils.getStatus(Arrays.asList(e.getFailingStatus()));
     } catch (QueryProcessException e) {
       logger.error("meet error while processing non-query. ", e);
-      return RpcUtils.getStatus(e.getErrorCode(), e.getMessage());
+      Throwable cause = e;
+      while (cause.getCause() != null){
+        cause = cause.getCause();
+      }
+      return RpcUtils.getStatus(e.getErrorCode(), cause.getMessage());
     } catch (Exception e) {
       logger.error("{}: server Internal Error: ", 
IoTDBConstant.GLOBAL_DB_NAME, e);
       return RpcUtils.getStatus(TSStatusCode.INTERNAL_SERVER_ERROR, 
e.getMessage());

Reply via email to