You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ta...@apache.org on 2021/07/20 14:11:17 UTC

[iotdb] branch rel/0.12 updated: [IOTDB-1456] Fix Error occurred while executing delete timeseries statement (#3474) (#3600)

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

tanxinyu pushed a commit to branch rel/0.12
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/rel/0.12 by this push:
     new 845ad2f  [IOTDB-1456] Fix Error occurred while executing delete timeseries statement (#3474) (#3600)
845ad2f is described below

commit 845ad2f16dcdfbef38a28484b5aa91c73794ced7
Author: cmlmakahts <82...@users.noreply.github.com>
AuthorDate: Tue Jul 20 22:10:52 2021 +0800

    [IOTDB-1456] Fix Error occurred while executing delete timeseries statement (#3474) (#3600)
---
 .../apache/iotdb/cluster/log/applier/BaseApplier.java   | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/log/applier/BaseApplier.java b/cluster/src/main/java/org/apache/iotdb/cluster/log/applier/BaseApplier.java
index 63231e3..d1e6d6a 100644
--- a/cluster/src/main/java/org/apache/iotdb/cluster/log/applier/BaseApplier.java
+++ b/cluster/src/main/java/org/apache/iotdb/cluster/log/applier/BaseApplier.java
@@ -38,6 +38,7 @@ import org.apache.iotdb.db.qp.executor.PlanExecutor;
 import org.apache.iotdb.db.qp.physical.BatchPlan;
 import org.apache.iotdb.db.qp.physical.PhysicalPlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertPlan;
+import org.apache.iotdb.db.qp.physical.sys.DeleteTimeSeriesPlan;
 import org.apache.iotdb.db.service.IoTDB;
 import org.apache.iotdb.db.utils.SchemaUtils;
 import org.apache.iotdb.rpc.TSStatusCode;
@@ -95,6 +96,7 @@ abstract class BaseApplier implements LogApplier {
   private void handleBatchProcessException(BatchProcessException e, PhysicalPlan plan)
       throws QueryProcessException, StorageEngineException, StorageGroupNotSetException {
     TSStatus[] failingStatus = e.getFailingStatus();
+    boolean needThrow = false;
     for (int i = 0; i < failingStatus.length; i++) {
       TSStatus status = failingStatus[i];
       // skip succeeded plans in later execution
@@ -103,6 +105,17 @@ abstract class BaseApplier implements LogApplier {
           && plan instanceof BatchPlan) {
         ((BatchPlan) plan).setIsExecuted(i);
       }
+      // handle batch exception thrown by delete timeseries plan, skip timeseries not exist
+      // exception
+      if (plan instanceof DeleteTimeSeriesPlan) {
+        if (status != null && status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
+          if (status.getCode() == TSStatusCode.TIMESERIES_NOT_EXIST.getStatusCode()) {
+            logger.info("{} doesn't exist, it may has been deleted.", plan.getPaths().get(i));
+          } else {
+            needThrow = true;
+          }
+        }
+      }
     }
     boolean needRetry = false;
     for (int i = 0, failingStatusLength = failingStatus.length; i < failingStatusLength; i++) {
@@ -118,7 +131,9 @@ abstract class BaseApplier implements LogApplier {
       executeAfterSync(plan);
       return;
     }
-    throw e;
+    if (!(plan instanceof DeleteTimeSeriesPlan) || needThrow) {
+      throw e;
+    }
   }
 
   private void executeAfterSync(PhysicalPlan plan)