You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Roman Khachatryan (Jira)" <ji...@apache.org> on 2022/03/28 09:19:00 UTC

[jira] [Resolved] (FLINK-26799) StateChangeFormat#read not seek to offset correctly

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

Roman Khachatryan resolved FLINK-26799.
---------------------------------------
    Resolution: Fixed

Merged into master as d5e472af4f817d343fae9073aad162ee13f08d6a

into 1.15 as 3fed74d757b.

> StateChangeFormat#read not seek to offset correctly
> ---------------------------------------------------
>
>                 Key: FLINK-26799
>                 URL: https://issues.apache.org/jira/browse/FLINK-26799
>             Project: Flink
>          Issue Type: Bug
>          Components: Runtime / State Backends
>    Affects Versions: 1.15.0, 1.16.0
>            Reporter: Feifan Wang
>            Assignee: Feifan Wang
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.15.0, 1.16.0
>
>         Attachments: image-2022-03-24-18-12-09-742.png
>
>
> StateChangeFormat#read must seek to offset before read, current implement as follows :
>  
> {code:java}
> FSDataInputStream stream = handle.openInputStream();
> DataInputViewStreamWrapper input = wrap(stream);
> if (stream.getPos() != offset) {
>     LOG.debug("seek from {} to {}", stream.getPos(), offset);
>     input.skipBytesToRead((int) offset);
> }{code}
> But the if condition is incorrect, stream.getPos() return the position of underlying stream which is different from position of input.
> By the way, because of wrapped by BufferedInputStream, position of underlying stream always at n*bufferSize or the end of file. 
> Actually, input is aways at position 0 at beginning, so I think we can seek to the offset directly.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)