akalash commented on a change in pull request #17440:
URL: https://github.com/apache/flink/pull/17440#discussion_r733419066
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/NettyPartitionRequestClient.java
##########
@@ -195,22 +195,26 @@ public void operationComplete(ChannelFuture future)
throws Exception {
@Override
public void notifyCreditAvailable(RemoteInputChannel inputChannel) {
- clientHandler.notifyCreditAvailable(inputChannel);
+ sendToChannel(new AddCreditMessage(inputChannel));
}
@Override
public void notifyNewBufferSize(RemoteInputChannel inputChannel, int
bufferSize) {
- clientHandler.notifyNewBufferSize(inputChannel, bufferSize);
+ sendToChannel(new NewBufferSizeMessage(inputChannel, bufferSize));
}
@Override
public void resumeConsumption(RemoteInputChannel inputChannel) {
- clientHandler.resumeConsumption(inputChannel);
+ sendToChannel(new ResumeConsumptionMessage(inputChannel));
}
@Override
public void acknowledgeAllRecordsProcessed(RemoteInputChannel
inputChannel) {
- clientHandler.acknowledgeAllRecordsProcessed(inputChannel);
+ sendToChannel(new AcknowledgeAllRecordsProcessedMessage(inputChannel));
+ }
+
+ private void sendToChannel(ClientOutboundMessage message) {
+ tcpChannel.eventLoop().execute(() ->
tcpChannel.pipeline().fireUserEventTriggered(message));
Review comment:
Unfortunatelly, it is not possible to get rid of
`tcpChannel.eventLoop().execute` because `executor.inEventLoop()` is always
`true` since this call happens in the network thread but we still don't want to
block the current execution and we want to send the massage in the other
thread(or in the same thread but later).
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/NettyPartitionRequestClient.java
##########
@@ -195,22 +195,26 @@ public void operationComplete(ChannelFuture future)
throws Exception {
@Override
public void notifyCreditAvailable(RemoteInputChannel inputChannel) {
- clientHandler.notifyCreditAvailable(inputChannel);
+ sendToChannel(new AddCreditMessage(inputChannel));
}
@Override
public void notifyNewBufferSize(RemoteInputChannel inputChannel, int
bufferSize) {
- clientHandler.notifyNewBufferSize(inputChannel, bufferSize);
+ sendToChannel(new NewBufferSizeMessage(inputChannel, bufferSize));
}
@Override
public void resumeConsumption(RemoteInputChannel inputChannel) {
- clientHandler.resumeConsumption(inputChannel);
+ sendToChannel(new ResumeConsumptionMessage(inputChannel));
}
@Override
public void acknowledgeAllRecordsProcessed(RemoteInputChannel
inputChannel) {
- clientHandler.acknowledgeAllRecordsProcessed(inputChannel);
+ sendToChannel(new AcknowledgeAllRecordsProcessedMessage(inputChannel));
+ }
+
+ private void sendToChannel(ClientOutboundMessage message) {
+ tcpChannel.eventLoop().execute(() ->
tcpChannel.pipeline().fireUserEventTriggered(message));
Review comment:
Actually, I can be wrong here and this problem can be related only to
the test. But right now, I don't ready to answer more precisely.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]