jiangxin369 commented on code in PR #23851:
URL: https://github.com/apache/flink/pull/23851#discussion_r1505241156


##########
flink-runtime/src/main/java/org/apache/flink/runtime/shuffle/NettyShuffleUtils.java:
##########
@@ -73,32 +69,32 @@ public static Tuple3<Integer, Integer, Integer> 
getMinMaxNetworkBuffersPerResult
             final int sortShuffleMinBuffers,
             final int numSubpartitions,
             final boolean enableTieredStorage,
+            final boolean enableMemoryDecoupling,
             final int tieredStoreExclusiveBuffers,
+            final int tieredStorageMinBuffersPerResultPartition,
             final ResultPartitionType type) {
         boolean isSortShuffle =
                 type.isBlockingOrBlockingPersistentResultPartition()
                         && numSubpartitions >= sortShuffleMinParallelism;
-        int expected;
-        if (isSortShuffle) {
-            expected = sortShuffleMinBuffers;
-        } else {
-            expected =
-                    enableTieredStorage
-                            ? Math.min(tieredStoreExclusiveBuffers, 
numSubpartitions + 1)
-                            : (numSubpartitions + 1);
-        }
+        boolean isMemoryDecouplingEnabled =
+                type.isHybridResultPartition() && enableTieredStorage && 
enableMemoryDecoupling;
 
-        int min = expected;
-        if (type.isHybridResultPartition()) {
-            min = Math.min(DEFAULT_HYBRID_SHUFFLE_MIN_BUFFERS, expected);
-        }
+        int expected =
+                isSortShuffle
+                        ? sortShuffleMinBuffers
+                        : (enableTieredStorage
+                                ? Math.min(tieredStoreExclusiveBuffers, 
numSubpartitions + 1)
+                                : (numSubpartitions + 1));
+
+        int min = isMemoryDecouplingEnabled ? 
tieredStorageMinBuffersPerResultPartition : expected;
+        expected = Math.max(min, expected);
 
         int max =
                 type.isBounded()
                         ? numSubpartitions * configuredNetworkBuffersPerChannel
                                 + numFloatingBuffersPerGate
                         : (isSortShuffle
-                                ? 4 * numSubpartitions
+                                ? Math.max(min, 4 * numSubpartitions)

Review Comment:
   Actually, I didn't change the logic. The initial code is `Math.max(min, 4 * 
numSubpartitions)` and I changed it to `4 * numSubpartitions` for cleaner code 
in the first commit. Then I changed it back in the third commit. So if you 
compare the code difference overall, it doesn't make any changes.



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to