You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/02/22 15:36:29 UTC
[GitHub] [flink] smattheis commented on a change in pull request #18865: [FLINK-25819][runtime] Reordered requesting and recycling buffers in order to avoid race condition in testIsAvailableOrNotAfterRequestAndRecycleMultiSegments
smattheis commented on a change in pull request #18865:
URL: https://github.com/apache/flink/pull/18865#discussion_r812076295
##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/io/network/buffer/NetworkBufferPoolTest.java
##########
@@ -292,6 +284,52 @@ public void testRequestMemorySegmentsMoreThanTotalBuffers() {
}
}
+ /**
+ * Tests {@link NetworkBufferPool#requestUnpooledMemorySegments(int)} with the total number of
+ * allocated buffers for several requests exceeding the capacity of {@link NetworkBufferPool}.
+ */
+ @Test
+ public void testInsufficientNumberOfBuffers() throws Exception {
+ final int numberOfSegmentsToRequest = 5;
+
+ final NetworkBufferPool globalPool = new NetworkBufferPool(numberOfSegmentsToRequest, 128);
+
+ try {
+ // the global pool should be in available state initially
+ assertTrue(globalPool.getAvailableFuture().isDone());
+
+ // request 5 segments
+ List<MemorySegment> segments1 =
+ globalPool.requestUnpooledMemorySegments(numberOfSegmentsToRequest);
+ assertFalse(globalPool.getAvailableFuture().isDone());
+ assertEquals(numberOfSegmentsToRequest, segments1.size());
+
+ try {
+ // request another 5 segments
+ globalPool.requestUnpooledMemorySegments(numberOfSegmentsToRequest);
Review comment:
Wouldn't be good to check that requesting even single one segment should fail to make sure it is empty? Or maybe both requesting one and five?
--
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-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org