You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2022/01/19 01:43:11 UTC

[iotdb] branch WarningLog012 created (now a84d428)

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

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


      at a84d428  When opening too many file handlers, reduce warning logs print

This branch includes the following new commits:

     new a84d428  When opening too many file handlers, reduce warning logs print

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: When opening too many file handlers, reduce warning logs print

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

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

commit a84d4289831ddfa18df0cffab3ce96f6dc1866d4
Author: JackieTien97 <ja...@gmail.com>
AuthorDate: Wed Jan 19 09:41:52 2022 +0800

    When opening too many file handlers, reduce warning logs print
---
 .../org/apache/iotdb/db/query/control/FileReaderManager.java  | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/query/control/FileReaderManager.java b/server/src/main/java/org/apache/iotdb/db/query/control/FileReaderManager.java
index 0046bf0..eae61c5 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/control/FileReaderManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/control/FileReaderManager.java
@@ -46,6 +46,11 @@ public class FileReaderManager {
   private static final int MAX_CACHED_FILE_SIZE = 30000;
 
   /**
+   * When number of file streams reached MAX_CACHED_FILE_SIZE, then we will print a warning log each PRINT_INTERVAL
+   */
+  private static final int PRINT_INTERVAL = 10000;
+
+  /**
    * the key of closedFileReaderMap is the file path and the value of closedFileReaderMap is the
    * corresponding reader.
    */
@@ -108,12 +113,12 @@ public class FileReaderManager {
     Map<String, TsFileSequenceReader> readerMap =
         !isClosed ? unclosedFileReaderMap : closedFileReaderMap;
     if (!readerMap.containsKey(filePath)) {
-
-      if (readerMap.size() >= MAX_CACHED_FILE_SIZE) {
+      int currentOpenedReaderCount = readerMap.size();
+      if (currentOpenedReaderCount >= MAX_CACHED_FILE_SIZE && (currentOpenedReaderCount % PRINT_INTERVAL == 0)) {
         logger.warn("Query has opened {} files !", readerMap.size());
       }
 
-      TsFileSequenceReader tsFileReader = null;
+      TsFileSequenceReader tsFileReader;
       // check if the file is old version
       if (!isClosed) {
         tsFileReader = new UnClosedTsFileReader(filePath);