use of org.apache.flink.runtime.operators.lifecycle.event.InputEndedEvent in project flink by apache.
the class DrainingValidator method validateSubtaskAttempt.
private void validateSubtaskAttempt(TestJobWithDescription job, String operatorId, int subtaskIndex, List<TestEvent> operatorEvents) {
BitSet endedInputs = new BitSet();
BitSet inputsWithMaxWatermark = new BitSet();
for (TestEvent ev : operatorEvents) {
if (ev instanceof WatermarkReceivedEvent) {
WatermarkReceivedEvent w = (WatermarkReceivedEvent) ev;
if (w.ts == Watermark.MAX_WATERMARK.getTimestamp()) {
assertFalse(String.format("Max Watermark received twice by %s/%d/%d", w.operatorId, w.subtaskIndex, w.inputId), inputsWithMaxWatermark.get(w.inputId));
inputsWithMaxWatermark.set(w.inputId);
}
} else if (ev instanceof InputEndedEvent) {
InputEndedEvent w = (InputEndedEvent) ev;
assertTrue(format("Input %d ended before receiving max watermark by %s[%d]#%d", w.inputId, operatorId, subtaskIndex, w.attemptNumber), inputsWithMaxWatermark.get(w.inputId));
assertFalse(endedInputs.get(w.inputId));
endedInputs.set(w.inputId);
}
}
assertEquals(format("Incorrect number of ended inputs for %s[%d]", operatorId, subtaskIndex), getNumInputs(job, operatorId), endedInputs.cardinality());
}
Aggregations