Skip to content

Commit c2f0c12

Browse files
committed
[FLINK-39521][network] CheckpointedInputGate: consume EndOfFetchedChannelStateEvent
When the consume path polls the EndOfFetchedChannelStateEvent sentinel, assert the originating channel is a RecoverableInputChannel and call its onRecoveredStateConsumed(): the channel flips out of recovery, releases any upstream events held back during recovery and reopens the upstream so live data may flow again. The event itself is never delivered to the operator. The sentinel-consumption path is exercised end to end by the Local/RemoteInputChannel recovery tests of this PR (onRecoveredStateConsumed after polling the sentinel) and by the StreamTask recovery tests of the follow-up PRs.
1 parent bf14146 commit c2f0c12

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

flink-runtime/src/main/java/org/apache/flink/streaming/runtime/io/checkpointing/CheckpointedInputGate.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@
2929
import org.apache.flink.runtime.io.network.api.EndOfPartitionEvent;
3030
import org.apache.flink.runtime.io.network.api.EventAnnouncement;
3131
import org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent;
32+
import org.apache.flink.runtime.io.network.partition.consumer.EndOfFetchedChannelStateEvent;
3233
import org.apache.flink.runtime.io.network.partition.consumer.EndOfOutputChannelStateEvent;
3334
import org.apache.flink.runtime.io.network.partition.consumer.InputChannel;
3435
import org.apache.flink.runtime.io.network.partition.consumer.InputGate;
36+
import org.apache.flink.runtime.io.network.partition.consumer.RecoverableInputChannel;
3537
import org.apache.flink.streaming.runtime.io.StreamTaskNetworkInput;
3638

3739
import org.slf4j.Logger;
@@ -202,6 +204,15 @@ private Optional<BufferOrEvent> handleEvent(BufferOrEvent bufferOrEvent) throws
202204
bufferOrEvent.getChannelInfo());
203205
} else if (bufferOrEvent.getEvent().getClass() == EndOfOutputChannelStateEvent.class) {
204206
upstreamRecoveryTracker.handleEndOfRecovery(bufferOrEvent.getChannelInfo());
207+
} else if (eventClass == EndOfFetchedChannelStateEvent.class) {
208+
// Tail of the recovered buffers: only a RecoverableInputChannel can produce this
209+
// sentinel, so anything else here is a bug rather than something to tolerate.
210+
InputChannel channel = inputGate.getChannel(bufferOrEvent.getChannelInfo());
211+
checkState(
212+
channel instanceof RecoverableInputChannel,
213+
"EndOfFetchedChannelStateEvent received on a non-recoverable channel %s",
214+
bufferOrEvent.getChannelInfo());
215+
((RecoverableInputChannel) channel).onRecoveredStateConsumed();
205216
}
206217
return Optional.of(bufferOrEvent);
207218
}

0 commit comments

Comments
 (0)