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 2019/06/28 13:58:11 UTC

[incubator-iotdb] branch feature_async_close_tsfile updated: remove chunk buffer log

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

qiaojialin pushed a commit to branch feature_async_close_tsfile
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/feature_async_close_tsfile by this push:
     new a1876a6  remove chunk buffer log
     new 0351f15  Merge remote-tracking branch 'origin/feature_async_close_tsfile' into feature_async_close_tsfile
a1876a6 is described below

commit a1876a62acf856b09dfaca50b609333120205caa
Author: qiaojialin <64...@qq.com>
AuthorDate: Fri Jun 28 21:57:21 2019 +0800

    remove chunk buffer log
---
 .../db/engine/filenodeV2/FileNodeProcessorV2.java  | 77 +++++++++++-----------
 .../filenodeV2/UnsealedTsFileProcessorV2.java      | 40 +++++------
 .../iotdb/db/engine/memtable/ChunkBufferPool.java  | 22 +++----
 3 files changed, 69 insertions(+), 70 deletions(-)

diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/filenodeV2/FileNodeProcessorV2.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/filenodeV2/FileNodeProcessorV2.java
index 9f3bdb3..fc7737e 100755
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/filenodeV2/FileNodeProcessorV2.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/filenodeV2/FileNodeProcessorV2.java
@@ -267,7 +267,7 @@ public class FileNodeProcessorV2 {
     UnsealedTsFileProcessorV2 unsealedTsFileProcessor;
     boolean result;
     // create a new BufferWriteProcessor
-    long start1 = System.currentTimeMillis();
+//    long start1 = System.currentTimeMillis();
     if (sequence) {
       if (workSequenceTsFileProcessor == null) {
         workSequenceTsFileProcessor = createTsFileProcessor(true);
@@ -281,19 +281,19 @@ public class FileNodeProcessorV2 {
       }
       unsealedTsFileProcessor = workUnSequenceTsFileProcessor;
     }
-    start1 = System.currentTimeMillis() - start1;
-    if (start1 > 1000) {
-      LOGGER.info("FNP {} create a new unsealed file processor cost: {}", storageGroupName, start1);
-    }
+//    start1 = System.currentTimeMillis() - start1;
+//    if (start1 > 1000) {
+//      LOGGER.info("FNP {} create a new unsealed file processor cost: {}", storageGroupName, start1);
+//    }
 
     // insert BufferWrite
-    long start2 = System.currentTimeMillis();
+//    long start2 = System.currentTimeMillis();
     result = unsealedTsFileProcessor.insert(insertPlan, sequence);
-    start2 = System.currentTimeMillis() - start2;
-    if (start2 > 1000) {
-      LOGGER.info("FNP {} insert a record into unsealed file processor cost: {}", storageGroupName,
-          start2);
-    }
+//    start2 = System.currentTimeMillis() - start2;
+//    if (start2 > 1000) {
+//      LOGGER.info("FNP {} insert a record into unsealed file processor cost: {}", storageGroupName,
+//          start2);
+//    }
 
     // try to update the latest time of the device of this tsRecord
     if (result && latestTimeForEachDevice.get(insertPlan.getDeviceId()) < insertPlan.getTime()) {
@@ -301,7 +301,7 @@ public class FileNodeProcessorV2 {
     }
 
     // check memtable size and may asyncFlush the workMemtable
-    long time1 = System.currentTimeMillis();
+//    long time1 = System.currentTimeMillis();
     if (unsealedTsFileProcessor.shouldFlush()) {
 
       LOGGER.info("The memtable size {} reaches the threshold, async flush it to tsfile: {}",
@@ -314,10 +314,10 @@ public class FileNodeProcessorV2 {
         unsealedTsFileProcessor.asyncFlush();
       }
     }
-    time1 = System.currentTimeMillis() - time1;
-    if (time1 > 1000) {
-      LOGGER.info("FNP {} check flush and close cost: {}ms", storageGroupName, time1);
-    }
+//    time1 = System.currentTimeMillis() - time1;
+//    if (time1 > 1000) {
+//      LOGGER.info("FNP {} check flush and close cost: {}ms", storageGroupName, time1);
+//    }
 
     return result;
   }
@@ -387,23 +387,23 @@ public class FileNodeProcessorV2 {
   }
 
   private void writeLock() {
-    long time = System.currentTimeMillis();
+//    long time = System.currentTimeMillis();
     insertLock.writeLock().lock();
-    time = System.currentTimeMillis() - time;
-    if (time > 1000) {
-      LOGGER.info("storage group {} wait for write lock cost: {}", storageGroupName, time,
-          new RuntimeException());
-    }
-    timerr.set(System.currentTimeMillis());
+//    time = System.currentTimeMillis() - time;
+//    if (time > 1000) {
+//      LOGGER.info("storage group {} wait for write lock cost: {}", storageGroupName, time,
+//          new RuntimeException());
+//    }
+//    timerr.set(System.currentTimeMillis());
   }
 
   private void writeUnlock() {
     insertLock.writeLock().unlock();
-    long time = System.currentTimeMillis() - timerr.get();
-    if (time > 1000) {
-      LOGGER.info("storage group {} take lock for {}ms", storageGroupName, time,
-          new RuntimeException());
-    }
+//    long time = System.currentTimeMillis() - timerr.get();
+//    if (time > 1000) {
+//      LOGGER.info("storage group {} take lock for {}ms", storageGroupName, time,
+//          new RuntimeException());
+//    }
   }
 
 
@@ -608,31 +608,30 @@ public class FileNodeProcessorV2 {
             .error("CloseFileNodeCondition occurs error while waiting for closing the file node {}",
                 storageGroupName, e);
       }
-      System.out.println("aaa");
     }
   }
 
 
   public boolean updateLatestFlushTimeCallback() {
-    long time = System.currentTimeMillis();
+//    long time = System.currentTimeMillis();
     writeLock();
     try {
       // update the largest timestamp in the last flushing memtable
-      long time1 = System.currentTimeMillis();
+//      long time1 = System.currentTimeMillis();
       for (Entry<String, Long> entry : latestTimeForEachDevice.entrySet()) {
         latestFlushedTimeForEachDevice.put(entry.getKey(), entry.getValue());
       }
-      time1 = System.currentTimeMillis() - time1;
-      if (time1 > 1000) {
-        LOGGER.info("update latest flush time call back cost {}ms", time1);
-      }
+//      time1 = System.currentTimeMillis() - time1;
+//      if (time1 > 1000) {
+//        LOGGER.info("update latest flush time call back cost {}ms", time1);
+//      }
     } finally {
       writeUnlock();
     }
-    time = System.currentTimeMillis() - time;
-    if (time > 1000) {
-      LOGGER.info("update latest flush time call back all cost {}ms", time);
-    }
+//    time = System.currentTimeMillis() - time;
+//    if (time > 1000) {
+//      LOGGER.info("update latest flush time call back all cost {}ms", time);
+//    }
     return true;
   }
 
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/filenodeV2/UnsealedTsFileProcessorV2.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/filenodeV2/UnsealedTsFileProcessorV2.java
index ff50ce4..dbd1f67 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/filenodeV2/UnsealedTsFileProcessorV2.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/filenodeV2/UnsealedTsFileProcessorV2.java
@@ -120,7 +120,7 @@ public class UnsealedTsFileProcessorV2 {
    */
   public boolean insert(InsertPlan insertPlan, boolean sequence) {
 
-    long start1 = System.currentTimeMillis();
+//    long start1 = System.currentTimeMillis();
     if (workMemTable == null) {
       // TODO change the impl of getEmptyMemTable to non-blocking
       workMemTable = MemTablePool.getInstance().getEmptyMemTable(this);
@@ -131,10 +131,10 @@ public class UnsealedTsFileProcessorV2 {
         return false;
       }
     }
-    start1 = System.currentTimeMillis() - start1;
-    if (start1 > 1000) {
-      LOGGER.info("UFP get a memtable cost: {}", start1);
-    }
+//    start1 = System.currentTimeMillis() - start1;
+//    if (start1 > 1000) {
+//      LOGGER.info("UFP get a memtable cost: {}", start1);
+//    }
 
     if (IoTDBDescriptor.getInstance().getConfig().isEnableWal()) {
       try {
@@ -150,15 +150,15 @@ public class UnsealedTsFileProcessorV2 {
       tsFileResource.updateEndTime(insertPlan.getDeviceId(), insertPlan.getTime());
     }
 
-    long start2 = System.currentTimeMillis();
+//    long start2 = System.currentTimeMillis();
     // insert tsRecord to work memtable
     workMemTable.insert(insertPlan);
-    start2 = System.currentTimeMillis() - start2;
-    if (start2 > 1000) {
-      LOGGER.info(
-          "UFP {} insert into memtable cost: {}, insertPlan: {}, current data points in memtable: {}",
-          storageGroupName, start2, insertPlan, workMemTable.size());
-    }
+//    start2 = System.currentTimeMillis() - start2;
+//    if (start2 > 1000) {
+//      LOGGER.info(
+//          "UFP {} insert into memtable cost: {}, insertPlan: {}, current data points in memtable: {}",
+//          storageGroupName, start2, insertPlan, workMemTable.size());
+//    }
 
     return true;
   }
@@ -204,7 +204,7 @@ public class UnsealedTsFileProcessorV2 {
   }
 
   public void syncClose() {
-    LOGGER.info("Synch close file: {}, first async close it",
+    LOGGER.info("Sync close file: {}, first async close it",
         tsFileResource.getFile().getAbsolutePath());
     asyncClose();
     synchronized (flushingMemTables) {
@@ -307,8 +307,8 @@ public class UnsealedTsFileProcessorV2 {
       writer.makeMetadataVisible();
       flushingMemTables.remove(memTable);
       memTable.release();
-      LOGGER.info("flush finished, remove a memtable from flushing list, "
-          + "flushing memtable list size: {}", flushingMemTables.size());
+      LOGGER.info("storage group {} flush finished, remove a memtable from flushing list, "
+          + "flushing memtable list size: {}", storageGroupName, flushingMemTables.size());
     } finally {
       flushQueryLock.writeLock().unlock();
     }
@@ -330,12 +330,12 @@ public class UnsealedTsFileProcessorV2 {
           storageGroupName,
           this::releaseFlushedMemTableCallback);
       flushTask.flushMemTable();
-      long start = System.currentTimeMillis();
+//      long start = System.currentTimeMillis();
       MemTablePool.getInstance().putBack(memTableToFlush, storageGroupName);
-      long elapse = System.currentTimeMillis() - start;
-      if (elapse > 1000) {
-        LOGGER.info("release a memtable cost: {}", elapse);
-      }
+//      long elapse = System.currentTimeMillis() - start;
+//      if (elapse > 1000) {
+//        LOGGER.info("release a memtable cost: {}", elapse);
+//      }
       if (IoTDBDescriptor.getInstance().getConfig().isEnableWal()) {
         getLogNode().notifyEndFlush();
       }
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/memtable/ChunkBufferPool.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/memtable/ChunkBufferPool.java
index e55f7d3..1a0cdf1 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/memtable/ChunkBufferPool.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/memtable/ChunkBufferPool.java
@@ -54,13 +54,13 @@ public class ChunkBufferPool {
     synchronized (availableChunkBuffer) {
       if (availableChunkBuffer.isEmpty() && size < capacity) {
         size++;
-        LOGGER.info("For fask, generated a new ChunkBuffer for {}, system ChunkBuffer size: {}, stack size: {}",
-            applier, size, availableChunkBuffer.size());
+//        LOGGER.info("For fask, generated a new ChunkBuffer for {}, system ChunkBuffer size: {}, stack size: {}",
+//            applier, size, availableChunkBuffer.size());
         return new ChunkBuffer(schema);
       } else if (!availableChunkBuffer.isEmpty()) {
-        LOGGER
-            .info("ReusableChunkBuffer size: {}, stack size: {}, then get a ChunkBuffer from stack for {}",
-                size, availableChunkBuffer.size(), applier);
+//        LOGGER
+//            .info("ReusableChunkBuffer size: {}, stack size: {}, then get a ChunkBuffer from stack for {}",
+//                size, availableChunkBuffer.size(), applier);
         ChunkBuffer chunkBuffer =  availableChunkBuffer.pop();
         chunkBuffer.reInit(schema);
         return chunkBuffer;
@@ -70,9 +70,9 @@ public class ChunkBufferPool {
       int waitCount = 1;
       while (true) {
         if (!availableChunkBuffer.isEmpty()) {
-          LOGGER.info(
-              "ReusableChunkBuffer size: {}, stack size: {}, then get a ChunkBuffer from stack for {}",
-              size, availableChunkBuffer.size(), applier);
+//          LOGGER.info(
+//              "ReusableChunkBuffer size: {}, stack size: {}, then get a ChunkBuffer from stack for {}",
+//              size, availableChunkBuffer.size(), applier);
           return availableChunkBuffer.pop();
         }
         try {
@@ -80,7 +80,7 @@ public class ChunkBufferPool {
         } catch (InterruptedException e) {
           LOGGER.error("{} fails to wait fot ReusableChunkBuffer {}, continue to wait", applier, e);
         }
-        LOGGER.info("{} has waited for a ReusableChunkBuffer for {}ms", applier, waitCount++ * WAIT_TIME);
+//        LOGGER.info("{} has waited for a ReusableChunkBuffer for {}ms", applier, waitCount++ * WAIT_TIME);
       }
     }
   }
@@ -90,7 +90,7 @@ public class ChunkBufferPool {
       chunkBuffer.reset();
       availableChunkBuffer.push(chunkBuffer);
       availableChunkBuffer.notify();
-      LOGGER.info("a chunk buffer returned, stack size {}", availableChunkBuffer.size());
+//      LOGGER.info("a chunk buffer returned, stack size {}", availableChunkBuffer.size());
     }
   }
 
@@ -99,7 +99,7 @@ public class ChunkBufferPool {
       chunkBuffer.reset();
       availableChunkBuffer.push(chunkBuffer);
       availableChunkBuffer.notify();
-      LOGGER.info("{} return a chunk buffer, stack size {}", storageGroup, availableChunkBuffer.size());
+//      LOGGER.info("{} return a chunk buffer, stack size {}", storageGroup, availableChunkBuffer.size());
     }
   }