You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ji...@apache.org on 2024/12/20 03:01:29 UTC

(iotdb) branch fix_wal_interruption created (now edcd256c46f)

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

jiangtian pushed a change to branch fix_wal_interruption
in repository https://gitbox.apache.org/repos/asf/iotdb.git


      at edcd256c46f add catch in WAL-sync thread

This branch includes the following new commits:

     new edcd256c46f add catch in WAL-sync thread

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: add catch in WAL-sync thread

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

jiangtian pushed a commit to branch fix_wal_interruption
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit edcd256c46faac0f8f4caf43aa5a4cd41abe06ba
Author: Tian Jiang <jt...@163.com>
AuthorDate: Fri Dec 20 11:04:07 2024 +0800

    add catch in WAL-sync thread
---
 .../test/java/org/apache/iotdb/db/it/IoTDBRestartIT.java    |  4 ++--
 .../db/storageengine/dataregion/wal/buffer/WALBuffer.java   | 13 +++++++++++--
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestartIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestartIT.java
index fad08f08c1f..4af52b7a19f 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestartIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestartIT.java
@@ -55,7 +55,7 @@ public class IoTDBRestartIT {
 
   @Before
   public void setUp() throws Exception {
-    EnvFactory.getEnv().getConfig().getCommonConfig().setWalMode("SYNC");
+    // EnvFactory.getEnv().getConfig().getCommonConfig().setWalMode("SYNC");
     EnvFactory.getEnv()
         .getConfig()
         .getCommonConfig()
@@ -66,7 +66,7 @@ public class IoTDBRestartIT {
   @After
   public void tearDown() throws Exception {
     EnvFactory.getEnv().cleanClusterEnvironment();
-    EnvFactory.getEnv().getConfig().getCommonConfig().setWalMode("ASYNC");
+    // EnvFactory.getEnv().getConfig().getCommonConfig().setWalMode("ASYNC");
     EnvFactory.getEnv()
         .getConfig()
         .getCommonConfig()
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/buffer/WALBuffer.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/buffer/WALBuffer.java
index cfe272225f7..80a0b9656a2 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/buffer/WALBuffer.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/buffer/WALBuffer.java
@@ -531,8 +531,7 @@ public class WALBuffer extends AbstractWALBuffer {
       this.info = info == null ? new SerializeInfo() : info;
     }
 
-    @Override
-    public void run() {
+    private void runInternal() {
       final long startTime = System.nanoTime();
 
       makeMemTableCheckpoints();
@@ -618,6 +617,15 @@ public class WALBuffer extends AbstractWALBuffer {
       WRITING_METRICS.recordSyncWALBufferCost(System.nanoTime() - startTime, forceFlag);
     }
 
+    @Override
+    public void run() {
+      try {
+        runInternal();
+      } catch (Exception e) {
+        logger.warn("Unexpected exception in sync wal buffer task.", e);
+      }
+    }
+
     private void makeMemTableCheckpoints() {
       if (info.checkpoints.isEmpty()) {
         return;
@@ -709,6 +717,7 @@ public class WALBuffer extends AbstractWALBuffer {
     MmapUtil.clean(workingBuffer);
     MmapUtil.clean(syncingBuffer);
     MmapUtil.clean(compressedByteBuffer);
+    logger.info("WAL Buffer {} is closed", this);
   }
 
   private void shutdownThread(ExecutorService thread, ThreadName threadName) {