hudi-agent commented on code in PR #20241:
URL: https://github.com/apache/hudi/pull/20241#discussion_r4235259795


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/partitioner/index/RecordIndexCache.java:
##########
@@ -182,16 +182,29 @@ public void markAsEvictable(long checkpointId) {
   }
 
   /**
-   * Performs the actual cleaning to release memory for new caches.
+   * Removes evictable empty caches and releases memory for new caches when 
needed.
    *
    * @param nextCacheSize the size for the next new cache
    */
   private void cleanIfNecessary(long nextCacheSize) {

Review Comment:
   🤖 nit: would it make sense to split `cleanIfNecessary` into two small 
helpers (e.g. `removeEvictableEmptyCaches()` and 
`evictUnderMemoryPressure(nextCacheSize)`)? The method now does two distinct 
things and the lambda with side effects inside `removeIf` is a bit hard to scan.
   
   <sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag 
quality.</i></sub>



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