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

qiaojialin 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 3b9bfc2  add log for all channel.force
3b9bfc2 is described below

commit 3b9bfc20cca8421a1cb7d8b5a32ecb7c381fa658
Author: qiaojialin <[email protected]>
AuthorDate: Wed Jul 28 15:26:23 2021 +0800

    add log for all channel.force
---
 .../main/java/org/apache/iotdb/db/writelog/io/LogWriter.java |  5 +++++
 .../apache/iotdb/db/writelog/node/ExclusiveWriteLogNode.java | 12 ++++++------
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/writelog/io/LogWriter.java 
b/server/src/main/java/org/apache/iotdb/db/writelog/io/LogWriter.java
index 1f19f8d..41de59e 100644
--- a/server/src/main/java/org/apache/iotdb/db/writelog/io/LogWriter.java
+++ b/server/src/main/java/org/apache/iotdb/db/writelog/io/LogWriter.java
@@ -99,7 +99,12 @@ public class LogWriter implements ILogWriter {
       channel.write(checkSumBuffer);
 
       if (this.forceEachWrite) {
+        long start = System.nanoTime();
         channel.force(true);
+        long elapse = System.nanoTime() - start;
+        if (elapse > 3_000_000_000L) {
+          logger.warn("[WAL] LogWriter channel.force cost {}ms", elapse / 
1_000_000L);
+        }
       }
     } catch (ClosedChannelException ignored) {
       logger.warn("someone interrupt current thread, so no need to do write 
for io safety");
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 bd86d55..80cbcc3 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
@@ -138,7 +138,6 @@ public class ExclusiveWriteLogNode implements WriteLogNode, 
Comparable<Exclusive
   @Override
   public void close() {
     sync();
-    logger.warn("[WAL] {} close!!!", this.hashCode());
     forceWal();
     long start = System.nanoTime();
     lock.lock();
@@ -264,12 +263,17 @@ public class ExclusiveWriteLogNode implements 
WriteLogNode, Comparable<Exclusive
   }
 
   private void forceWal() {
-    long start = System.nanoTime();
     lock.lock();
     try {
       try {
         if (currentFileWriter != null) {
+          long start = System.nanoTime();
           currentFileWriter.force();
+          long elapse = System.nanoTime() - start;
+          if (elapse > 3_000_000_000L) {
+            logger.warn(
+                "[WAL] {} flushBuffer write log cost {}ms", this.hashCode(), 
elapse / 1_000_000L);
+          }
         }
       } catch (IOException e) {
         logger.warn("Log node {} force failed.", identifier, e);
@@ -277,10 +281,6 @@ public class ExclusiveWriteLogNode implements 
WriteLogNode, Comparable<Exclusive
     } finally {
       lock.unlock();
     }
-    long elapse = System.nanoTime() - start;
-    if (elapse > 3_000_000_000L) {
-      logger.warn("[WAL] {} flushBuffer write log cost {}ms", this.hashCode(), 
elapse / 1_000_000L);
-    }
   }
 
   private void sync() {

Reply via email to