You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2025/07/15 03:22:23 UTC

(iotdb) branch GracelyExit-1.3 created (now 6aeee1365eb)

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

jackietien pushed a change to branch GracelyExit-1.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git


      at 6aeee1365eb [To dev/1.3] Avoid NPE while stop DN

This branch includes the following new commits:

     new 6aeee1365eb [To dev/1.3] Avoid NPE while stop DN

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(iotdb) 01/01: [To dev/1.3] Avoid NPE while stop DN

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jackietien pushed a commit to branch GracelyExit-1.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 6aeee1365ebbf5dd99ee3443ce2554952f965b1f
Author: JackieTien97 <ja...@gmail.com>
AuthorDate: Tue Jul 15 11:22:11 2025 +0800

    [To dev/1.3] Avoid NPE while stop DN
---
 .../java/org/apache/iotdb/db/schemaengine/SchemaEngine.java    | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/SchemaEngine.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/SchemaEngine.java
index 0ad1cc6f10b..cf5dc24169f 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/SchemaEngine.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/SchemaEngine.java
@@ -242,7 +242,7 @@ public class SchemaEngine {
     }
   }
 
-  public void clear() {
+  public synchronized void clear() {
     schemaRegionLoader.clear();
 
     // clearSchemaResource will shut down release and flush task in PBTree mode, which must be
@@ -260,6 +260,7 @@ public class SchemaEngine {
       }
       schemaRegionMap.clear();
       schemaRegionMap = null;
+      logger.info("clear schema region map.");
     }
     // SchemaMetric should be cleared lastly
     if (schemaMetricManager != null) {
@@ -282,7 +283,10 @@ public class SchemaEngine {
 
   public synchronized void createSchemaRegion(
       PartialPath storageGroup, SchemaRegionId schemaRegionId) throws MetadataException {
-    ISchemaRegion schemaRegion = schemaRegionMap.get(schemaRegionId);
+    if (this.schemaRegionMap == null) {
+      throw new MetadataException("Peer is shutting down now.");
+    }
+    final ISchemaRegion schemaRegion = this.schemaRegionMap.get(schemaRegionId);
     if (schemaRegion != null) {
       if (schemaRegion.getDatabaseFullPath().equals(storageGroup.getFullPath())) {
         return;
@@ -294,7 +298,7 @@ public class SchemaEngine {
                 schemaRegionId, schemaRegion.getDatabaseFullPath(), storageGroup.getFullPath()));
       }
     }
-    schemaRegionMap.put(
+    this.schemaRegionMap.put(
         schemaRegionId, createSchemaRegionWithoutExistenceCheck(storageGroup, schemaRegionId));
   }