jerqi commented on code in PR #1531:
URL: 
https://github.com/apache/incubator-uniffle/pull/1531#discussion_r1492460393


##########
server/src/main/java/org/apache/uniffle/server/buffer/ShuffleBufferManager.java:
##########
@@ -241,22 +265,34 @@ void flushSingleBufferIfNecessary(
     boolean isHugePartition = isHugePartition(appId, shuffleId, partitionId);
     // When we use multi storage and trigger single buffer flush, the buffer 
size should be bigger
     // than rss.server.flush.cold.storage.threshold.size, otherwise cold 
storage will be useless.
-    if ((isHugePartition || this.bufferFlushEnabled)
-        && buffer.getSize() > this.bufferFlushThreshold) {
+    long size = nettyServerEnabled ? buffer.getEstimatedSize() : 
buffer.getSize();
+    if ((isHugePartition || this.bufferFlushEnabled) && size > 
this.bufferFlushThreshold) {
       flushBuffer(buffer, appId, shuffleId, startPartition, endPartition, 
isHugePartition);
       return;
     }
   }
 
   public void flushIfNecessary() {
     // if data size in buffer > highWaterMark, do the flush
-    if (usedMemory.get() - preAllocatedSize.get() - inFlushSize.get() > 
highWaterMark) {

Review Comment:
   Could you extract a method to make logic more clearer?



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to