samperson1997 commented on a change in pull request #1100:
URL: https://github.com/apache/incubator-iotdb/pull/1100#discussion_r417691678



##########
File path: 
server/src/main/java/org/apache/iotdb/db/engine/cache/TsFileMetaDataCache.java
##########
@@ -55,24 +54,24 @@
   /**
    * estimated size of a deviceMetaDataMap entry in TsFileMetaData.

Review comment:
       Thanks for this good catch!

##########
File path: 
server/src/main/java/org/apache/iotdb/db/engine/cache/TsFileMetaDataCache.java
##########
@@ -55,24 +54,24 @@
   /**
    * estimated size of a deviceMetaDataMap entry in TsFileMetaData.
    */
-  private long deviceIndexMapEntrySize = 0;
+  private long metadataIndexEntrySize = 0;
 
   private TsFileMetaDataCache() {
     logger.info("TsFileMetaDataCache size = " + MEMORY_THRESHOLD_IN_B);
     cache = new LRULinkedHashMap<String, 
TsFileMetadata>(MEMORY_THRESHOLD_IN_B, true) {
       @Override
       protected long calEntrySize(String key, TsFileMetadata value) {
-        if (deviceIndexMapEntrySize == 0 && value.getDeviceMetadataIndex() != 
null
-            && value.getDeviceMetadataIndex().size() > 0) {
-          deviceIndexMapEntrySize = RamUsageEstimator
-              
.sizeOf(value.getDeviceMetadataIndex().entrySet().iterator().next());
+        if (metadataIndexEntrySize == 0 && value.getMetadataIndex() != null
+            && !value.getMetadataIndex().getChildren().isEmpty()) {
+          metadataIndexEntrySize = RamUsageEstimator
+              
.sizeOf(value.getMetadataIndex().getChildren().iterator().next());
         }
         // totalChunkNum, invalidChunkNum
         long valueSize = 4 + 4L;
 
         // deviceMetadataIndex
-        if (value.getDeviceMetadataIndex() != null) {
-          valueSize += value.getDeviceMetadataIndex().size() * 
deviceIndexMapEntrySize;
+        if (value.getMetadataIndex() != null) {

Review comment:
       Fixed




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to