You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2022/04/28 12:19:09 UTC

[iotdb] branch master updated: [IOTDB-3030] delete storage group with ** error (#5718)

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

qiaojialin 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 eadc582377 [IOTDB-3030] delete storage group with ** error (#5718)
eadc582377 is described below

commit eadc582377ea7c71d90e0b807b0329a5accd1bfa
Author: Haonan <hh...@outlook.com>
AuthorDate: Thu Apr 28 20:19:05 2022 +0800

    [IOTDB-3030] delete storage group with ** error (#5718)
---
 .../db/integration/IoTDBDeleteStorageGroupIT.java  | 24 ++++++++++++++++++++++
 .../iotdb/db/localconfignode/LocalConfigNode.java  |  7 +++++--
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBDeleteStorageGroupIT.java b/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBDeleteStorageGroupIT.java
index ac5873b0b6..2c3700c9d1 100644
--- a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBDeleteStorageGroupIT.java
+++ b/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBDeleteStorageGroupIT.java
@@ -25,6 +25,7 @@ import org.apache.iotdb.itbase.category.RemoteTest;
 import org.apache.iotdb.jdbc.IoTDBSQLException;
 
 import org.junit.After;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -180,4 +181,27 @@ public class IoTDBDeleteStorageGroupIT {
       assertEquals(1, count);
     }
   }
+
+  @Test
+  public void testSelectIntoAndDeleteStorageGroup() throws Exception {
+    try (Connection connection = EnvFactory.getEnv().getConnection();
+        Statement statement = connection.createStatement()) {
+      statement.execute(
+          "create schema template t1 (temperature FLOAT encoding=RLE, status BOOLEAN encoding=PLAIN compression=SNAPPY)");
+      statement.execute("set schema template t1 to root.sg1.d1;");
+      statement.execute("create timeseries of schema template on root.sg1.d1;");
+      statement.execute("show timeseries root.sg1.**;");
+      statement.execute("show devices root.sg1.**;");
+      statement.execute("insert into root.sg1.d1(time, temperature, status) values(1, 1, TRUE);");
+      statement.execute(
+          "insert into root.sg1.d1(time, temperature, status) values(2, 2, FALSE), (3, 3, TRUE);");
+      statement.execute("select temperature into h1 from root.sg1.**;");
+      statement.execute("select temperature,h1 from root.sg1.**;");
+      statement.execute("show schema templates;");
+      statement.execute("delete storage group root.**;");
+      statement.execute("drop schema template t1;");
+    } catch (Exception e) {
+      Assert.fail();
+    }
+  }
 }
diff --git a/server/src/main/java/org/apache/iotdb/db/localconfignode/LocalConfigNode.java b/server/src/main/java/org/apache/iotdb/db/localconfignode/LocalConfigNode.java
index 07630b54b5..96b0fedb11 100644
--- a/server/src/main/java/org/apache/iotdb/db/localconfignode/LocalConfigNode.java
+++ b/server/src/main/java/org/apache/iotdb/db/localconfignode/LocalConfigNode.java
@@ -233,8 +233,11 @@ public class LocalConfigNode {
   public void deleteStorageGroup(PartialPath storageGroup) throws MetadataException {
 
     DeleteTimeSeriesPlan deleteTimeSeriesPlan =
-        SchemaSyncManager.getInstance()
-            .splitDeleteTimeseriesPlanByDevice(storageGroup.concatNode(MULTI_LEVEL_PATH_WILDCARD));
+        SchemaSyncManager.getInstance().isEnableSync()
+            ? SchemaSyncManager.getInstance()
+                .splitDeleteTimeseriesPlanByDevice(
+                    storageGroup.concatNode(MULTI_LEVEL_PATH_WILDCARD))
+            : null;
 
     deleteSchemaRegionsInStorageGroup(
         storageGroup, schemaPartitionTable.getSchemaRegionIdsByStorageGroup(storageGroup));