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

tanxinyu pushed a commit to branch rc/1.3.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/rc/1.3.3 by this push:
     new 3de1034abe8 [to rel/1.3.3] Rename IoTDBShutdownHook to 
DataNodeShutdownHook & Delay the execution of the “clear lock file” step in 
DataNodeShutdownHook  (#13482)
3de1034abe8 is described below

commit 3de1034abe8c2d0a2174f568cb8b4f94657531ed
Author: Li Yu Heng <[email protected]>
AuthorDate: Thu Sep 12 09:59:37 2024 +0800

    [to rel/1.3.3] Rename IoTDBShutdownHook to DataNodeShutdownHook & Delay the 
execution of the “clear lock file” step in DataNodeShutdownHook  (#13482)
    
    * done
    
    * add comment
---
 .../main/java/org/apache/iotdb/db/service/DataNode.java    |  2 +-
 .../{IoTDBShutdownHook.java => DataNodeShutdownHook.java}  | 14 +++++++-------
 .../org/apache/iotdb/commons/concurrent/ThreadName.java    |  4 ++--
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNode.java 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNode.java
index d7be7efff4b..993ead5c61a 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNode.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNode.java
@@ -710,7 +710,7 @@ public class DataNode extends ServerCommandLine implements 
DataNodeMBean {
     // Get resources for trigger,udf,pipe...
     prepareResources();
 
-    Runtime.getRuntime().addShutdownHook(new 
IoTDBShutdownHook(generateDataNodeLocation()));
+    Runtime.getRuntime().addShutdownHook(new 
DataNodeShutdownHook(generateDataNodeLocation()));
     setUncaughtExceptionHandler();
 
     logger.info("Recover the schema...");
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/IoTDBShutdownHook.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNodeShutdownHook.java
similarity index 94%
rename from 
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/IoTDBShutdownHook.java
rename to 
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNodeShutdownHook.java
index 8ef6bbdc430..b060634982c 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/IoTDBShutdownHook.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNodeShutdownHook.java
@@ -46,14 +46,14 @@ import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
 
-public class IoTDBShutdownHook extends Thread {
+public class DataNodeShutdownHook extends Thread {
 
-  private static final Logger logger = 
LoggerFactory.getLogger(IoTDBShutdownHook.class);
+  private static final Logger logger = 
LoggerFactory.getLogger(DataNodeShutdownHook.class);
 
   private final TDataNodeLocation nodeLocation;
 
-  public IoTDBShutdownHook(TDataNodeLocation nodeLocation) {
-    super(ThreadName.IOTDB_SHUTDOWN_HOOK.getName());
+  public DataNodeShutdownHook(TDataNodeLocation nodeLocation) {
+    super(ThreadName.DATANODE_SHUTDOWN_HOOK.getName());
     this.nodeLocation = nodeLocation;
   }
 
@@ -115,9 +115,6 @@ public class IoTDBShutdownHook extends Thread {
       logger.error("Stop ConsensusImpl error in IoTDBShutdownHook", e);
     }
 
-    // Clear lock file
-    DirectoryChecker.getInstance().deregisterAll();
-
     // Set and report shutdown to cluster ConfigNode-leader
     
CommonDescriptor.getInstance().getConfig().setNodeStatus(NodeStatus.Unknown);
     boolean isReportSuccess = false;
@@ -141,6 +138,9 @@ public class IoTDBShutdownHook extends Thread {
           "Reporting DataNode shutdown failed. The cluster will still take the 
current DataNode as Running for a few seconds.");
     }
 
+    // Clear lock file. All services should be shutdown before this line.
+    DirectoryChecker.getInstance().deregisterAll();
+
     if (logger.isInfoEnabled()) {
       logger.info(
           "DataNode exits. Jvm memory usage: {}",
diff --git 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/ThreadName.java
 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/ThreadName.java
index 102022417e9..c82d3f12b81 100644
--- 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/ThreadName.java
+++ 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/ThreadName.java
@@ -178,7 +178,7 @@ public enum ThreadName {
   INFLUXDB_RPC_PROCESSOR("InfluxdbRPC-Processor"),
   STORAGE_ENGINE_CACHED_POOL("StorageEngine"),
   AINODE_RPC_SERVICE("AINodeRpc-Service"),
-  IOTDB_SHUTDOWN_HOOK("IoTDB-Shutdown-Hook"),
+  DATANODE_SHUTDOWN_HOOK("DataNode-Shutdown-Hook"),
   UPGRADE_TASK("UpgradeThread"),
   REGION_MIGRATE("Region-Migrate-Pool"),
   STORAGE_ENGINE_RECOVER_TRIGGER("StorageEngine-RecoverTrigger"),
@@ -367,7 +367,7 @@ public enum ThreadName {
               INFLUXDB_RPC_PROCESSOR,
               STORAGE_ENGINE_CACHED_POOL,
               AINODE_RPC_SERVICE,
-              IOTDB_SHUTDOWN_HOOK,
+              DATANODE_SHUTDOWN_HOOK,
               UPGRADE_TASK,
               REGION_MIGRATE,
               STORAGE_ENGINE_RECOVER_TRIGGER));

Reply via email to