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

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


The following commit(s) were added to refs/heads/autoai_debug by this push:
     new 0169d8a  rollback wal
0169d8a is described below

commit 0169d8a7ae6aa0c235675418ce45f7923c0a32f6
Author: LebronAl <[email protected]>
AuthorDate: Wed Aug 4 14:59:35 2021 +0800

    rollback wal
---
 .../org/apache/iotdb/db/writelog/node/ExclusiveWriteLogNode.java   | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/writelog/node/ExclusiveWriteLogNode.java
 
b/server/src/main/java/org/apache/iotdb/db/writelog/node/ExclusiveWriteLogNode.java
index 30c1213..f55d109 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/writelog/node/ExclusiveWriteLogNode.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/writelog/node/ExclusiveWriteLogNode.java
@@ -28,6 +28,7 @@ import org.apache.iotdb.db.writelog.io.ILogWriter;
 import org.apache.iotdb.db.writelog.io.LogWriter;
 import org.apache.iotdb.db.writelog.io.MultiFileLogReader;
 
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
 import org.apache.commons.io.FileUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -68,8 +69,9 @@ public class ExclusiveWriteLogNode implements WriteLogNode, 
Comparable<Exclusive
 
   private final Object switchBufferCondition = new Object();
   private final ReentrantLock lock = new ReentrantLock();
-  private final ExecutorService FLUSH_BUFFER_THREAD_POOL =
-      Executors.newSingleThreadExecutor(r -> new Thread(r, "Flush-WAL-Thread-" 
+ this.hashCode()));
+  private static final ExecutorService FLUSH_BUFFER_THREAD_POOL =
+      Executors.newCachedThreadPool(
+          new 
ThreadFactoryBuilder().setNameFormat("Flush-WAL-Thread%d").build());
 
   private long fileId = 0;
   private long lastFlushedId = 0;
@@ -229,7 +231,6 @@ public class ExclusiveWriteLogNode implements WriteLogNode, 
Comparable<Exclusive
       deleted.set(true);
       return this.bufferArray;
     } finally {
-      FLUSH_BUFFER_THREAD_POOL.shutdown();
       lock.unlock();
       long elapse = System.nanoTime() - start;
       if (elapse > 3_000_000_000L) {

Reply via email to