You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2022/11/16 09:52:24 UTC
[iotdb] branch master updated: [IOTDB-4951] Response failure if drop non-existent pipe (#8008)
This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 76e3d015dc [IOTDB-4951] Response failure if drop non-existent pipe (#8008)
76e3d015dc is described below
commit 76e3d015dcd86a54e9904a625903f7bf69eff094
Author: Chen YZ <43...@users.noreply.github.com>
AuthorDate: Wed Nov 16 17:52:19 2022 +0800
[IOTDB-4951] Response failure if drop non-existent pipe (#8008)
---
.../confignode/procedure/impl/sync/DropPipeProcedure.java | 10 +++-------
.../src/test/java/org/apache/iotdb/db/it/sync/IoTDBPipeIT.java | 7 ++++++-
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/sync/DropPipeProcedure.java b/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/sync/DropPipeProcedure.java
index f7c35e320a..fd7f6f36a8 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/sync/DropPipeProcedure.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/sync/DropPipeProcedure.java
@@ -20,7 +20,6 @@ package org.apache.iotdb.confignode.procedure.impl.sync;
import org.apache.iotdb.common.rpc.thrift.TSStatus;
import org.apache.iotdb.commons.exception.sync.PipeException;
-import org.apache.iotdb.commons.exception.sync.PipeNotExistException;
import org.apache.iotdb.commons.sync.pipe.PipeInfo;
import org.apache.iotdb.commons.sync.pipe.PipeStatus;
import org.apache.iotdb.commons.sync.pipe.SyncOperation;
@@ -60,12 +59,9 @@ public class DropPipeProcedure extends AbstractOperatePipeProcedure {
@Override
boolean executeCheckCanSkip(ConfigNodeProcedureEnv env) throws PipeException {
LOGGER.info("Start to drop PIPE [{}]", pipeName);
- try {
- PipeInfo pipeInfo = env.getConfigManager().getSyncManager().getPipeInfo(pipeName);
- return false;
- } catch (PipeNotExistException e) {
- return true;
- }
+ // throw PipeNotExistException if pipe not exist
+ PipeInfo pipeInfo = env.getConfigManager().getSyncManager().getPipeInfo(pipeName);
+ return false;
}
@Override
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/sync/IoTDBPipeIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/sync/IoTDBPipeIT.java
index bf2876ae0d..64c02557e3 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/sync/IoTDBPipeIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/sync/IoTDBPipeIT.java
@@ -158,7 +158,12 @@ public class IoTDBPipeIT {
}
statement.execute("DROP PIPE p1;");
statement.execute("DROP PIPE p2;");
- statement.execute("DROP PIPE p3;");
+ try {
+ statement.execute("DROP PIPE p3;");
+ Assert.fail();
+ } catch (Exception e) {
+ Assert.assertTrue(e.getMessage().contains("PIPE [p3] does not exist"));
+ }
try (ResultSet resultSet = statement.executeQuery("SHOW PIPE")) {
String[] expectedRetSet = new String[] {};
assertResultSetEqual(resultSet, SHOW_PIPE_HEADER, expectedRetSet);