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 2020/04/14 14:22:14 UTC

[incubator-iotdb] branch master updated: add comment for MetadataQuerierByFileImpl (#1046)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 9acf647  add comment for MetadataQuerierByFileImpl (#1046)
9acf647 is described below

commit 9acf64724adf661f9598faf0b6617086c31d2f32
Author: Jialin Qiao <qj...@mails.tsinghua.edu.cn>
AuthorDate: Tue Apr 14 22:22:04 2020 +0800

    add comment for MetadataQuerierByFileImpl (#1046)
---
 .../iotdb/tsfile/read/controller/MetadataQuerierByFileImpl.java    | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/controller/MetadataQuerierByFileImpl.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/controller/MetadataQuerierByFileImpl.java
index 74714fa..aa86346 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/controller/MetadataQuerierByFileImpl.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/controller/MetadataQuerierByFileImpl.java
@@ -33,7 +33,8 @@ import java.util.*;
 
 public class MetadataQuerierByFileImpl implements IMetadataQuerier {
 
-  private static final int CHUNK_METADATA_CACHE_SIZE = 10000;
+  // number of cache entries (path -> List<ChunkMetadata>)
+  private static final int CACHED_ENTRY_NUMBER = 1000;
 
   private TsFileMetadata fileMetaData;
 
@@ -47,7 +48,7 @@ public class MetadataQuerierByFileImpl implements IMetadataQuerier {
   public MetadataQuerierByFileImpl(TsFileSequenceReader tsFileReader) throws IOException {
     this.tsFileReader = tsFileReader;
     this.fileMetaData = tsFileReader.readFileMetadata();
-    chunkMetaDataCache = new LRUCache<Path, List<ChunkMetadata>>(CHUNK_METADATA_CACHE_SIZE) {
+    chunkMetaDataCache = new LRUCache<Path, List<ChunkMetadata>>(CACHED_ENTRY_NUMBER) {
       @Override
       public List<ChunkMetadata> loadObjectByKey(Path key) throws IOException {
         return loadChunkMetadata(key);
@@ -131,7 +132,7 @@ public class MetadataQuerierByFileImpl implements IMetadataQuerier {
 
           // check cache size, stop when reading enough
           count++;
-          if (count == CHUNK_METADATA_CACHE_SIZE) {
+          if (count == CACHED_ENTRY_NUMBER) {
             enough = true;
             break;
           }