Search in sources :

Example 6 with SegmentIO

use of org.apache.ignite.internal.processors.cache.persistence.wal.io.SegmentIO in project ignite by apache.

the class StandaloneWalRecordsIterator method initReadHandle.

/**
 * {@inheritDoc}
 */
@Override
protected AbstractReadFileHandle initReadHandle(@NotNull AbstractFileDescriptor desc, @Nullable WALPointer start) throws IgniteCheckedException, FileNotFoundException {
    AbstractFileDescriptor fd = desc;
    SegmentIO fileIO = null;
    SegmentHeader segmentHeader;
    while (true) {
        try {
            fileIO = fd.toReadOnlyIO(ioFactory);
            segmentHeader = readSegmentHeader(fileIO, FILE_INPUT_FACTORY);
            break;
        } catch (IOException | IgniteCheckedException e) {
            log.error("Failed to init segment curWalSegmIdx=" + curWalSegmIdx + ", curIdx=" + curIdx, e);
            U.closeQuiet(fileIO);
            curIdx++;
            if (curIdx >= walFileDescriptors.size())
                return null;
            fd = walFileDescriptors.get(curIdx);
        }
    }
    return initReadHandle(fd, start, fileIO, segmentHeader);
}
Also used : SegmentIO(org.apache.ignite.internal.processors.cache.persistence.wal.io.SegmentIO) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) RecordV1Serializer.readSegmentHeader(org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordV1Serializer.readSegmentHeader) SegmentHeader(org.apache.ignite.internal.processors.cache.persistence.wal.serializer.SegmentHeader) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)6 SegmentIO (org.apache.ignite.internal.processors.cache.persistence.wal.io.SegmentIO)6 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)4 DataInput (java.io.DataInput)2 EOFException (java.io.EOFException)2 File (java.io.File)2 StorageException (org.apache.ignite.internal.processors.cache.persistence.StorageException)2 FileIO (org.apache.ignite.internal.processors.cache.persistence.file.FileIO)2 FileWriteHandle (org.apache.ignite.internal.processors.cache.persistence.wal.filehandle.FileWriteHandle)2 RecordV1Serializer.readSegmentHeader (org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordV1Serializer.readSegmentHeader)2 SegmentHeader (org.apache.ignite.internal.processors.cache.persistence.wal.serializer.SegmentHeader)2 Nullable (org.jetbrains.annotations.Nullable)2 FileNotFoundException (java.io.FileNotFoundException)1 ClosedByInterruptException (java.nio.channels.ClosedByInterruptException)1 FailureContext (org.apache.ignite.failure.FailureContext)1 ByteBufferExpander (org.apache.ignite.internal.processors.cache.persistence.wal.ByteBufferExpander)1 FileDescriptor (org.apache.ignite.internal.processors.cache.persistence.wal.FileDescriptor)1 WALPointer (org.apache.ignite.internal.processors.cache.persistence.wal.WALPointer)1 RecordSerializer (org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordSerializer)1 RecordSerializerFactoryImpl (org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordSerializerFactoryImpl)1