zhijiangW commented on a change in pull request #7368: [FLINK-10742][network]
Let Netty use Flink's buffers directly in credit-based mode
URL: https://github.com/apache/flink/pull/7368#discussion_r390795221
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/io/network/netty/CreditBasedPartitionRequestClientHandlerTest.java
##########
@@ -419,6 +458,86 @@ public void testNotifyCreditAvailableAfterReleased()
throws Exception {
}
}
+ @Test
+ public void testReadBufferResponseBeforeReleasingChannel() throws
Exception {
+ testReadBufferResponseWithReleasingOrRemovingChannel(false,
true);
+ }
+
+ @Test
+ public void testReadBufferResponseBeforeRemovingChannel() throws
Exception {
+ testReadBufferResponseWithReleasingOrRemovingChannel(true,
true);
+ }
+
+ @Test
+ public void testReadBufferResponseAfterReleasingChannel() throws
Exception {
+ testReadBufferResponseWithReleasingOrRemovingChannel(false,
false);
+ }
+
+ @Test
+ public void testReadBufferResponseAfterRemovingChannel() throws
Exception {
+ testReadBufferResponseWithReleasingOrRemovingChannel(true,
false);
+ }
+
+ private void testReadBufferResponseWithReleasingOrRemovingChannel(
+ boolean isRemoved,
+ boolean readBeforeReleasingOrRemoving) throws Exception {
+
+ int bufferSize = 1024;
+
+ NetworkBufferPool networkBufferPool = new NetworkBufferPool(10,
bufferSize, 2);
+ SingleInputGate inputGate = createSingleInputGate(1);
+ RemoteInputChannel inputChannel = new InputChannelBuilder()
+ .setMemorySegmentProvider(networkBufferPool)
+ .buildRemoteAndSetToGate(inputGate);
+ inputGate.assignExclusiveSegments();
+
+ CreditBasedPartitionRequestClientHandler handler = new
CreditBasedPartitionRequestClientHandler();
+ EmbeddedChannel embeddedChannel = new EmbeddedChannel(handler);
+ handler.addInputChannel(inputChannel);
+
+ try {
+ if (readBeforeReleasingOrRemoving) {
Review comment:
It actually reads after releasing channel. readBeforeReleasingOrRemoving ->
!readBeforeReleasingOrRemoving
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services