[ 
https://issues.apache.org/jira/browse/FLINK-41718?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Martijn Visser reassigned FLINK-41718:
--------------------------------------

    Assignee: Martijn Visser

> VirtualChannel#hasPartialData misses a pending spanning record, so the 
> recovery checks for unconsumed data never fire
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-41718
>                 URL: https://issues.apache.org/jira/browse/FLINK-41718
>             Project: Flink
>          Issue Type: Bug
>          Components: Runtime / Checkpointing
>    Affects Versions: 2.4.0, 2.5.0, 1.20.7, 2.3.2
>            Reporter: Martijn Visser
>            Assignee: Martijn Visser
>            Priority: Major
>
> VirtualChannel#hasPartialData returns !lastResult.isBufferConsumed(). The 
> deserializer returns PARTIAL_RECORD when a buffer ends in the middle of a 
> record, and PARTIAL_RECORD counts as buffer consumed. So hasPartialData is 
> false exactly when bytes of a record are still pending.
> Two checks depend on it and have never fired:
> * RescalingStreamTaskNetworkInput#finishRecovery, "Not all data has been 
> fully consumed" (added in FLINK-19801)
> * SequentialChannelStateReaderImpl#readInputData, "Not all data has been 
> fully consumed during filtering" (added in FLINK-38930)
> Both run after the upstream output state has been read, so a record that is 
> still pending at that point never completes and is dropped silently.
> Reproducer with LongSerializer: one complete record plus the first 8 of the 
> 13 bytes of a second one, in a single recovered buffer. Record 1 is emitted, 
> finishRecovery returns, record 2 is lost.
> {code:java}
> byte[] partial = Arrays.copyOf(serializeLongRecord(42L), 8);
> vc.setNextBuffer(wrapBuffer(partial));
> assertThat(vc.getNextRecord(delegate)).isEqualTo(DeserializationResult.PARTIAL_RECORD);
> assertThat(vc.hasPartialData()).isTrue(); // false
> {code}
> A correct job never reaches this state; it only matters when the recovered 
> data is already misframed. The fix can't rely on lastResult alone, because an 
> empty buffer also returns PARTIAL_RECORD. It needs to ask the deserializer 
> whether it still holds bytes.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to