zhijiangW commented on a change in pull request #8559: [FLINK-12576][Network,
Metrics]Take localInputChannel into account when compute inputQueueLength
URL: https://github.com/apache/flink/pull/8559#discussion_r304776032
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/consumer/SingleInputGateTest.java
##########
@@ -559,6 +561,57 @@ public void testUpdateUnknownInputChannel() throws
Exception {
}
}
+ @Test
+ public void testQueuedBuffers() throws Exception {
+ final NettyShuffleEnvironment network =
createNettyShuffleEnvironment();
+
+ final ResultPartition localResultPartition = new
ResultPartitionBuilder()
+
.setResultPartitionManager(network.getResultPartitionManager())
+
.setupBufferPoolFactoryFromNettyShuffleEnvironment(network)
+ .build();
+
+ final ResultPartition remoteResultPartition = new
ResultPartitionBuilder()
+
.setResultPartitionManager(network.getResultPartitionManager())
+
.setupBufferPoolFactoryFromNettyShuffleEnvironment(network)
+ .build();
+
+ localResultPartition.setup();
+ remoteResultPartition.setup();
+
+ final SingleInputGate inputGate = createInputGate(network, 2,
ResultPartitionType.PIPELINED);
+
+ try {
+ final ResultPartitionID localResultPartitionId =
localResultPartition.getPartitionId();
+ addUnknownInputChannel(network, inputGate,
localResultPartitionId, 0);
+ LocalInputChannel localInputChannel =
InputChannelBuilder.newBuilder()
+ .setChannelIndex(0)
+ .setPartitionId(localResultPartitionId)
+ .setupFromNettyShuffleEnvironment(network)
+ .setConnectionManager(new
TestingConnectionManager())
+ .buildLocalAndSetToGate(inputGate);
+
+ final ResultPartitionID remoteResultPartitionId =
remoteResultPartition.getPartitionId();
+ RemoteInputChannel remoteInputChannel =
InputChannelBuilder.newBuilder()
+ .setChannelIndex(1)
+ .setPartitionId(remoteResultPartitionId)
+ .setupFromNettyShuffleEnvironment(network)
+ .setConnectionManager(new
TestingConnectionManager())
+ .buildRemoteAndSetToGate(inputGate);
+
+ inputGate.setup();
+
+
remoteInputChannel.onBuffer(TestBufferFactory.createBuffer(1), 0, 0);
+ assertEquals(1, inputGate.getNumberOfQueuedBuffers());
+
+
localResultPartition.addBufferConsumer(BufferBuilderTestUtils.createBufferBuilder(1).createBufferConsumer(),
0);
Review comment:
Might use `BufferBuilderTestUtils .createFilledBufferConsumer(1)` directly
----------------------------------------------------------------
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