[ 
https://issues.apache.org/jira/browse/IGNITE-11687?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16810748#comment-16810748
 ] 

Alexey Goncharuk commented on IGNITE-11687:
-------------------------------------------

I believe this was broken long ago when {{SegmentedRingByteBuffer}} was 
introduced. In WAL manager we have the following code:
{code}
hdl.written += hdl.fileIO.writeFully(buf);
{code}
which appears to write a fully serialized batch of records, however, this may 
be not the case when ring byte buffer returns a list of buffers to write.

At the first glance, it should be enough to update {{written}} field after all 
buffers polled from the ring are written in {{WALWriter}}. [~agura], what do 
you think?

> Concurrent WAL replay & log may fail with CRC error on read
> -----------------------------------------------------------
>
>                 Key: IGNITE-11687
>                 URL: https://issues.apache.org/jira/browse/IGNITE-11687
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Alexey Goncharuk
>            Priority: Major
>
> The cause is the way {{end}} is calculated for WAL iterator:
> {code}
> if (hnd != null)
>     end = hnd.position();
> {code}
> {code}
>     @Override public FileWALPointer position() {
>         lock.lock();
>         try {
>             return new FileWALPointer(getSegmentId(), (int)written, 0);
>         }
>         finally {
>             lock.unlock();
>         }
>     }
> {code}
> Consider a partially written entry. In this case, {{written}} has been 
> already updated, concurrent WAL replay will attempt to read the incompletely 
> written record and since {{end}} is not null, iterator will fail with CRC 
> error.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to