flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhijiangW <...@git.apache.org>
Subject [GitHub] flink pull request #4485: [FLINK-7378][core]Create a fix size (non rebalanci...
Date Fri, 15 Sep 2017 07:15:46 GMT
Github user zhijiangW commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4485#discussion_r139078792
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/NetworkBufferPool.java
---
    @@ -159,23 +159,20 @@ public void recycle(MemorySegment segment) {
     
     			this.numTotalRequiredBuffers += numRequiredBuffers;
     
    -			final List<MemorySegment> segments = new ArrayList<>(numRequiredBuffers);
    -			for (int i = 0 ; i < numRequiredBuffers ; i++) {
    -				segments.add(availableMemorySegments.poll());
    -			}
    +			redistributeBuffers();
    +		}
     
    +		final List<MemorySegment> segments = new ArrayList<>(numRequiredBuffers);
    +		for (int i = 0 ; i < numRequiredBuffers ; i++) {
     			try {
    -				redistributeBuffers();
    -			} catch (IOException e) {
    -				if (segments.size() > 0) {
    -					recycleMemorySegments(segments);
    -				}
    -
    +				segments.add(availableMemorySegments.take());
    --- End diff --
    
    Yes, I think this way seems better than always blocking to wait.  It is very nice of you
to give the specific test. 👍 


---

Mime
View raw message