jt2594838 commented on code in PR #18806:
URL: https://github.com/apache/iotdb/pull/18806#discussion_r4236218535


##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/ProcedureExecutor.java:
##########
@@ -134,12 +140,17 @@ public void init(int numThreads) {
     workId.set(0);
     workerThreads = new CopyOnWriteArrayList<>();
     for (int i = 0; i < corePoolSize; i++) {
-      workerThreads.add(new WorkerThread(threadGroup));
+      workerThreads.add(new WorkerThread(threadGroup, scheduler));
     }
+    dropTableWorkerThreads = new CopyOnWriteArrayList<>();
+    dropTableWorkerThreads.add(
+        new WorkerThread(threadGroup, dropTableScheduler, 
"DropTableProcedureWorker-"));

Review Comment:
   Better to delay the init until the first DropTable comes.



##########
integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBTableIT.java:
##########
@@ -1229,4 +1230,79 @@ public void testTreeViewTable() throws Exception {
       }
     }
   }
+
+  @Test
+  public void testAsyncDropTableProgress() throws Exception {
+    try (final Connection connection =
+            EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT);
+        final Statement statement = connection.createStatement()) {
+      statement.execute("create database async_drop_db");
+      statement.execute("use async_drop_db");
+      statement.execute("create table drop_target (device string tag, reading 
int32)");
+      statement.execute("drop table drop_target");
+
+      try (final ResultSet resultSet =
+          statement.executeQuery(
+              "select procedure_id, state, progress "
+                  + "from information_schema.drop_table_procedures "
+                  + "where database = 'async_drop_db' and table_name = 
'drop_target'")) {
+        assertTrue(resultSet.next());
+        assertTrue(resultSet.getLong(1) >= 0);
+        assertFalse(resultSet.getString(2).isEmpty());
+        assertFalse(resultSet.getString(3).isEmpty());
+        assertFalse(resultSet.next());
+      }
+
+      awaitDropProcedure(statement, "async_drop_db", "drop_target");
+      TestUtils.assertResultSetEqual(
+          statement.executeQuery("show tables from async_drop_db"),
+          "TableName,TTL(ms),",
+          Collections.emptySet());
+      try (final ResultSet resultSet =
+          statement.executeQuery(
+              "select procedure_id, state, progress, error_message "
+                  + "from information_schema.drop_table_procedures "
+                  + "where database = 'async_drop_db' and table_name = 
'drop_target'")) {
+        assertTrue(resultSet.next());
+        assertTrue(resultSet.getLong(1) >= 0);
+        assertEquals("SUCCESS", resultSet.getString(2));
+        assertEquals("SUCCESS", resultSet.getString(3));
+        Assert.assertNull(resultSet.getString(4));
+        assertFalse(resultSet.next());
+      }

Review Comment:
   Are the results stored even after the procedure finishes? How long and how 
many?



##########
integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBTableIT.java:
##########
@@ -1229,4 +1230,79 @@ public void testTreeViewTable() throws Exception {
       }
     }
   }
+
+  @Test
+  public void testAsyncDropTableProgress() throws Exception {
+    try (final Connection connection =
+            EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT);
+        final Statement statement = connection.createStatement()) {
+      statement.execute("create database async_drop_db");
+      statement.execute("use async_drop_db");
+      statement.execute("create table drop_target (device string tag, reading 
int32)");
+      statement.execute("drop table drop_target");
+
+      try (final ResultSet resultSet =
+          statement.executeQuery(
+              "select procedure_id, state, progress "
+                  + "from information_schema.drop_table_procedures "
+                  + "where database = 'async_drop_db' and table_name = 
'drop_target'")) {
+        assertTrue(resultSet.next());
+        assertTrue(resultSet.getLong(1) >= 0);
+        assertFalse(resultSet.getString(2).isEmpty());
+        assertFalse(resultSet.getString(3).isEmpty());
+        assertFalse(resultSet.next());
+      }

Review Comment:
   The procedure may finish before the query starts.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to