You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by zy...@apache.org on 2023/05/09 13:40:11 UTC

[iotdb] branch master updated: [IOTDB-5831] Fix create region failure after recreate db (#9800)

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

zyk 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 5c20ee49d3 [IOTDB-5831] Fix create region failure after recreate db (#9800)
5c20ee49d3 is described below

commit 5c20ee49d390e258e85ac4cb5124ba945492210f
Author: Marcos_Zyk <38...@users.noreply.github.com>
AuthorDate: Tue May 9 21:40:03 2023 +0800

    [IOTDB-5831] Fix create region failure after recreate db (#9800)
---
 .../iotdb/confignode/manager/ClusterSchemaManager.java      | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/manager/ClusterSchemaManager.java b/confignode/src/main/java/org/apache/iotdb/confignode/manager/ClusterSchemaManager.java
index f2212337fc..e9a47e0fd5 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/manager/ClusterSchemaManager.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/manager/ClusterSchemaManager.java
@@ -232,7 +232,18 @@ public class ClusterSchemaManager {
    * @return DatabaseSchemaResp
    */
   public DatabaseSchemaResp getMatchedDatabaseSchema(GetDatabasePlan getStorageGroupPlan) {
-    return (DatabaseSchemaResp) getConsensusManager().read(getStorageGroupPlan).getDataset();
+    DatabaseSchemaResp resp =
+        (DatabaseSchemaResp) getConsensusManager().read(getStorageGroupPlan).getDataset();
+    List<String> preDeletedDatabaseList = new ArrayList<>();
+    for (String database : resp.getSchemaMap().keySet()) {
+      if (getPartitionManager().isDatabasePreDeleted(database)) {
+        preDeletedDatabaseList.add(database);
+      }
+    }
+    for (String preDeletedDatabase : preDeletedDatabaseList) {
+      resp.getSchemaMap().remove(preDeletedDatabase);
+    }
+    return resp;
   }
 
   /** Only used in cluster tool show Databases. */