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

jiangtian 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 9921e4ea1c9 Interrupt wal-delete thread when WALManager is closed 
(#15442)
9921e4ea1c9 is described below

commit 9921e4ea1c9e880704944ade3acb5c5998f532ef
Author: Jiang Tian <[email protected]>
AuthorDate: Thu May 8 12:16:08 2025 +0800

    Interrupt wal-delete thread when WALManager is closed (#15442)
---
 .../org/apache/iotdb/db/storageengine/dataregion/wal/WALManager.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/WALManager.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/WALManager.java
index a048438f005..7d9f7bb4679 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/WALManager.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/WALManager.java
@@ -166,6 +166,7 @@ public class WALManager implements IService {
     logger.info("Start rebooting wal delete thread.");
     if (walDeleteThread != null) {
       shutdownThread(walDeleteThread, ThreadName.WAL_DELETE);
+      walDeleteThread = null;
     }
     logger.info("Stop wal delete thread successfully, and now restart it.");
     registerScheduleTask(0, config.getDeleteWalFilesPeriodInMs());
@@ -179,7 +180,7 @@ public class WALManager implements IService {
     // threshold, the system continues to delete expired files until the disk 
size is smaller than
     // the threshold.
     boolean firstLoop = true;
-    while (firstLoop || shouldThrottle()) {
+    while ((firstLoop || shouldThrottle()) && !Thread.interrupted()) {
       deleteOutdatedFilesInWALNodes();
       if (firstLoop && shouldThrottle()) {
         logger.warn(
@@ -275,7 +276,7 @@ public class WALManager implements IService {
   }
 
   private void shutdownThread(ExecutorService thread, ThreadName threadName) {
-    thread.shutdown();
+    thread.shutdownNow();
     try {
       if (!thread.awaitTermination(30, TimeUnit.SECONDS)) {
         logger.warn("Waiting thread {} to be terminated is timeout", 
threadName.getName());

Reply via email to