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:26:02 GMT
Github user zhijiangW commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4485#discussion_r139080289
  
    --- Diff: flink-runtime/src/test/java/org/apache/flink/runtime/io/network/buffer/NetworkBufferPoolTest.java
---
    @@ -172,44 +178,117 @@ public void testDestroyAll() {
     		}
     	}
     
    +	/**
    +	 * Tests {@link NetworkBufferPool#requestMemorySegments(int)} with the {@link NetworkBufferPool}
    +	 * currently containing the number of required free segments.
    +	 */
     	@Test
    -	public void testRequestAndRecycleMemorySegments() throws Exception {
    +	public void testRequestMemorySegmentsLessThanTotalBuffers() throws Exception {
     		final int numBuffers = 10;
     
     		NetworkBufferPool globalPool = new NetworkBufferPool(numBuffers, 128, MemoryType.HEAP);
     
    -		List<MemorySegment> segments = null;
    -		// request buffers from global pool with illegal argument
    +		List<MemorySegment> memorySegments = Collections.emptyList();
     		try {
    -			segments = globalPool.requestMemorySegments(0);
    -			fail("Should throw an IllegalArgumentException");
    -		} catch (IllegalArgumentException e) {
    -			assertNull(segments);
    +			memorySegments = globalPool.requestMemorySegments(numBuffers / 2);
    +
    +			assertEquals(memorySegments.size(), numBuffers / 2);
    +		} finally {
    +			globalPool.recycleMemorySegments(memorySegments);
     			assertEquals(globalPool.getNumberOfAvailableMemorySegments(), numBuffers);
    --- End diff --
    
    yes


---

Mime
View raw message