vinothchandar commented on a change in pull request #3955:
URL: https://github.com/apache/hudi/pull/3955#discussion_r746731186



##########
File path: 
hudi-common/src/main/java/org/apache/hudi/common/util/collection/ExternalSpillableMap.java
##########
@@ -204,19 +205,21 @@ public R get(Object key) {
   public R put(T key, R value) {
     if (this.currentInMemoryMapSize < maxInMemorySizeInBytes || 
inMemoryMap.containsKey(key)) {
       if (shouldEstimatePayloadSize && estimatedPayloadSize == 0) {
-        // At first, use the sizeEstimate of a record being inserted into the 
spillable map.
-        // Note, the converter may over estimate the size of a record in the 
JVM
+        // At first, use the size estimate of a record being inserted into the 
Spillable map.
+        // Note, the converter may overestimate the size of a record in the 
JVM.
         this.estimatedPayloadSize = keySizeEstimator.sizeEstimate(key) + 
valueSizeEstimator.sizeEstimate(value);
-        LOG.info("Estimated Payload size => " + estimatedPayloadSize);
-      } else if (shouldEstimatePayloadSize && inMemoryMap.size() % 
NUMBER_OF_RECORDS_TO_ESTIMATE_PAYLOAD_SIZE == 0) {
+        LOG.debug("Estimated Payload size => " + estimatedPayloadSize);
+      } else if (shouldEstimatePayloadSize
+          && !inMemoryMap.isEmpty()
+          && (inMemoryMap.size() % NUMBER_OF_RECORDS_TO_ESTIMATE_PAYLOAD_SIZE 
== 0)) {

Review comment:
       ah ok. I don't think we remove from the map per se, anywhere. that's 
probably why its all fine now. good catch. 




-- 
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.

To unsubscribe, e-mail: [email protected]

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


Reply via email to