You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2021/07/28 03:00:06 UTC

[iotdb] branch autoai_debug updated: add log 1

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 c1a8941  add log 1
c1a8941 is described below

commit c1a8941eabd8bb12ab227f5b6e5a892584b31d92
Author: qiaojialin <64...@qq.com>
AuthorDate: Wed Jul 28 10:59:29 2021 +0800

    add log 1
---
 .../db/writelog/node/ExclusiveWriteLogNode.java    | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)

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 e982c77..e45a46c 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
@@ -104,7 +104,12 @@ public class ExclusiveWriteLogNode implements WriteLogNode, Comparable<Exclusive
     if (deleted.get()) {
       throw new IOException("WAL node deleted");
     }
+    long start = System.nanoTime();
     lock.lock();
+    long elapse = System.nanoTime() - start;
+    if (elapse > 3_000_000_000L) {
+      logger.warn("[WAL] {} write plan get lock cost {}ms", this.hashCode(), elapse / 1_000_000L);
+    }
     try {
       putLog(plan);
       if (bufferedLogNum >= config.getFlushWalThreshold()) {
@@ -257,8 +262,17 @@ public class ExclusiveWriteLogNode implements WriteLogNode, Comparable<Exclusive
       if (bufferedLogNum == 0) {
         return;
       }
+      long start = System.nanoTime();
       switchBufferWorkingToFlushing();
+      long elapse = System.nanoTime() - start;
+      if (elapse > 3_000_000_000L) {
+        logger.warn(
+            "[WAL] {} switch buffer working -> flushing cost {}ms",
+            this.hashCode(),
+            elapse / 1_000_000L);
+      }
       ILogWriter currWriter = getCurrentFileWriter();
+      logger.warn("[WAL] {} submit flushBuffer task", this.hashCode());
       FLUSH_BUFFER_THREAD_POOL.submit(() -> flushBuffer(currWriter));
       bufferedLogNum = 0;
       logger.debug("Log node {} ends sync.", identifier);
@@ -284,11 +298,20 @@ public class ExclusiveWriteLogNode implements WriteLogNode, Comparable<Exclusive
     }
 
     // switch buffer flushing to idle and notify the sync thread
+    long start = System.nanoTime();
     synchronized (switchBufferCondition) {
       logBufferIdle = logBufferFlushing;
       logBufferFlushing = null;
       switchBufferCondition.notifyAll();
     }
+    long elapse = System.nanoTime() - start;
+    if (elapse > 3_000_000_000L) {
+      logger.warn(
+          "[WAL] {} switch buffer flushing -> idle cost {}ms",
+          this.hashCode(),
+          elapse / 1_000_000L);
+    }
+    logger.warn("[WAL] {} flushBuffer task end", this.hashCode());
   }
 
   private void switchBufferWorkingToFlushing() throws InterruptedException {