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

Alexey Goncharuk updated IGNITE-8661:
-------------------------------------
    Description: 
Currently, we have the following code in RecordV1Serializer.readWithCrc:
{code:java}
static WALRecord readWithCrc(.....) throws EOFException, IgniteCheckedException 
{
  
    try (FileInput.Crc32CheckingFileInput in = in0.startRead(skipCrc)) {
      ..... 
    }
    catch (EOFException | SegmentEofException | WalSegmentTailReachedException 
e) {
        throw e;
    }
    catch (Exception e) {
        throw new IgniteCheckedException("Failed to read WAL record at 
position: " + startPos, e);
    }
}
{code}
So, any runtime error will be remapped to IgniteCheckedException, which will 
lead to iterator stop due to the following code:

AbstractWalRecordsIterator.advanceRecord:

{code}
   try {
         ......
        }
        catch (IOException | IgniteCheckedException e) {
            if (e instanceof WalSegmentTailReachedException)
                throw (WalSegmentTailReachedException)e;

            if (!(e instanceof SegmentEofException))
                handleRecordException(e, actualFilePtr);

            return null;
        }
{code}

Any IgniteCheckedException will be ignored and iterator goes ahead to the next 
segment. 

I suggest to make the following changes:
1) It is unexpected behavior, need to fix it. We should only stop iteration on 
known exceptions
2) Also, need to provide ability skip records by type or some pointer for the 
StandaloneWalRecordsIterator

  was:

RecordV1Serializer.readWithCrc
{code:java}
static WALRecord readWithCrc(.....) throws EOFException, IgniteCheckedException 
{
  
    try (FileInput.Crc32CheckingFileInput in = in0.startRead(skipCrc)) {
      ..... 
    }
    catch (EOFException | SegmentEofException | WalSegmentTailReachedException 
e) {
        throw e;
    }
    catch (Exception e) {
        throw new IgniteCheckedException("Failed to read WAL record at 
position: " + startPos, e);
    }
}
{code}

Any runtime error will be remapped to IgniteCheckedException 

AbstractWalRecordsIterator.advanceRecord

{code}
   try {
         ......
        }
        catch (IOException | IgniteCheckedException e) {
            if (e instanceof WalSegmentTailReachedException)
                throw (WalSegmentTailReachedException)e;

            if (!(e instanceof SegmentEofException))
                handleRecordException(e, actualFilePtr);

            return null;
        }
{code}

Any IgniteCheckedException will be ignored and iterator goes ahead to the next 
segment. 
1) It is unexpected behavior, need to fix it.
2) Also, need to provide ability skip records by type or some pointer for the 
StandaloneWalRecordsIterator
Create new factory method which will accept filter predicate as parameter for 
creation skipped iterator.


> WALItreater is not stopped if can not deserialize record 
> ---------------------------------------------------------
>
>                 Key: IGNITE-8661
>                 URL: https://issues.apache.org/jira/browse/IGNITE-8661
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Dmitriy Govorukhin
>            Priority: Major
>             Fix For: 2.6
>
>
> Currently, we have the following code in RecordV1Serializer.readWithCrc:
> {code:java}
> static WALRecord readWithCrc(.....) throws EOFException, 
> IgniteCheckedException {
>   
>     try (FileInput.Crc32CheckingFileInput in = in0.startRead(skipCrc)) {
>       ..... 
>     }
>     catch (EOFException | SegmentEofException | 
> WalSegmentTailReachedException e) {
>         throw e;
>     }
>     catch (Exception e) {
>         throw new IgniteCheckedException("Failed to read WAL record at 
> position: " + startPos, e);
>     }
> }
> {code}
> So, any runtime error will be remapped to IgniteCheckedException, which will 
> lead to iterator stop due to the following code:
> AbstractWalRecordsIterator.advanceRecord:
> {code}
>    try {
>          ......
>         }
>         catch (IOException | IgniteCheckedException e) {
>             if (e instanceof WalSegmentTailReachedException)
>                 throw (WalSegmentTailReachedException)e;
>             if (!(e instanceof SegmentEofException))
>                 handleRecordException(e, actualFilePtr);
>             return null;
>         }
> {code}
> Any IgniteCheckedException will be ignored and iterator goes ahead to the 
> next segment. 
> I suggest to make the following changes:
> 1) It is unexpected behavior, need to fix it. We should only stop iteration 
> on known exceptions
> 2) Also, need to provide ability skip records by type or some pointer for the 
> StandaloneWalRecordsIterator



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

Reply via email to