danny0405 commented on code in PR #13232:
URL: https://github.com/apache/hudi/pull/13232#discussion_r2065684618


##########
hudi-common/src/main/java/org/apache/hudi/common/util/collection/ExternalSpillableMap.java:
##########
@@ -217,21 +217,18 @@ public R get(Object key) {
 
   @Override
   public R put(T key, R value) {
-    if (this.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
-      this.estimatedPayloadSize = keySizeEstimator.sizeEstimate(key) + 
valueSizeEstimator.sizeEstimate(value);
-    } else if (this.inMemoryMap.size() % 
NUMBER_OF_RECORDS_TO_ESTIMATE_PAYLOAD_SIZE == 0) {
-      this.estimatedPayloadSize = (long) (this.estimatedPayloadSize * 0.9 + 
(keySizeEstimator.sizeEstimate(key) + valueSizeEstimator.sizeEstimate(value)) * 
0.1);
-      this.currentInMemoryMapSize = this.inMemoryMap.size() * 
this.estimatedPayloadSize;
-      if (this.inMemoryMap.size() / NUMBER_OF_RECORDS_TO_ESTIMATE_PAYLOAD_SIZE 
== 1) {
-        LOG.info("{} : Updated Estimated Payload size {}", loggingContext, 
this.estimatedPayloadSize);
-      }
-    }
-
     if (this.inMemoryMap.containsKey(key)) {
       this.inMemoryMap.put(key, value);
     } else if (this.currentInMemoryMapSize < this.maxInMemorySizeInBytes) {
+      if (this.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
+        this.estimatedPayloadSize = keySizeEstimator.sizeEstimate(key) + 
valueSizeEstimator.sizeEstimate(value);
+      } else if (this.inMemoryMap.size() % 
NUMBER_OF_RECORDS_TO_ESTIMATE_PAYLOAD_SIZE == 0) {
+        this.estimatedPayloadSize = (long) (this.estimatedPayloadSize * 0.9 + 
(keySizeEstimator.sizeEstimate(key) + valueSizeEstimator.sizeEstimate(value)) * 
0.1);
+        this.currentInMemoryMapSize = this.inMemoryMap.size() * 
this.estimatedPayloadSize;

Review Comment:
   The `this.inMemoryMap.size() / NUMBER_OF_RECORDS_TO_ESTIMATE_PAYLOAD_SIZE == 
1` check seems always false, so I remove the check and also switch the log to 
debug level because 1/100 records number of logging is stll numerous.



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