public abstract class AbstractWalRecordsIterator extends GridCloseableIteratorAdapter<IgniteBiTuple<WALPointer,WALRecord>> implements WALIterator
| Modifier and Type | Class and Description |
|---|---|
protected static interface |
AbstractWalRecordsIterator.AbstractFileDescriptor |
protected static interface |
AbstractWalRecordsIterator.AbstractReadFileHandle |
| Modifier and Type | Field and Description |
|---|---|
protected IgniteBiTuple<WALPointer,WALRecord> |
curRec
Current record preloaded, to be returned on next()
Normally this should be not null because advance() method should already prepare some value |
protected long |
curWalSegmIdx
Current WAL segment absolute index.
|
protected @NotNull FileIOFactory |
ioFactory
Factory to provide I/O interfaces for read/write operations with files
|
protected @NotNull IgniteLogger |
log
Logger
|
protected @NotNull GridCacheSharedContext |
sharedCtx
Shared context for creating serializer of required version and grid name access.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractWalRecordsIterator(@NotNull IgniteLogger log,
@NotNull GridCacheSharedContext sharedCtx,
@NotNull RecordSerializerFactory serializerFactory,
@NotNull FileIOFactory ioFactory,
int initialReadBufferSize,
SegmentFileInputFactory segmentFileInputFactory) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
advance()
Switches records iterator to the next record.
|
protected IgniteBiTuple<WALPointer,WALRecord> |
advanceRecord(@Nullable AbstractWalRecordsIterator.AbstractReadFileHandle hnd)
Switches to new record.
|
protected abstract AbstractWalRecordsIterator.AbstractReadFileHandle |
advanceSegment(@Nullable AbstractWalRecordsIterator.AbstractReadFileHandle curWalSegment)
Switches records iterator to the next WAL segment as result of this method, new reference to segment should be
returned.
|
protected @Nullable AbstractWalRecordsIterator.AbstractReadFileHandle |
closeCurrentWalSegment()
Closes and returns WAL segment (if any)
|
protected abstract AbstractWalRecordsIterator.AbstractReadFileHandle |
createReadFileHandle(SegmentIO fileIO,
RecordSerializer ser,
FileInput in) |
protected IgniteCheckedException |
handleRecordException(@NotNull Exception e,
@Nullable WALPointer ptr)
Handler for record deserialization exception.
|
protected AbstractWalRecordsIterator.AbstractReadFileHandle |
initReadHandle(@NotNull AbstractWalRecordsIterator.AbstractFileDescriptor desc,
@Nullable WALPointer start)
Assumes file descriptor will be opened in this method.
|
protected AbstractWalRecordsIterator.AbstractReadFileHandle |
initReadHandle(@NotNull AbstractWalRecordsIterator.AbstractFileDescriptor desc,
@Nullable WALPointer start,
@NotNull SegmentIO fileIO,
@NotNull SegmentHeader segmentHeader)
Assumes fileIO will be closed in this method in case of error occurred.
|
Optional<WALPointer> |
lastRead() |
protected void |
onClose()
Invoked on iterator close.
|
protected boolean |
onHasNext() |
protected IgniteBiTuple<WALPointer,WALRecord> |
onNext() |
protected @NotNull WALRecord |
postProcessRecord(@NotNull WALRecord rec)
Performs final conversions with record loaded from WAL.
|
protected IgniteCheckedException |
validateTailReachedException(WalSegmentTailReachedException tailReachedException,
AbstractWalRecordsIterator.AbstractReadFileHandle currWalSegment) |
checkClosed, close, hasNextX, isClosed, nextX, onRemove, removeXhasNext, iterator, next, removeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, isClosedhasNextX, nextX, removeXforEach, iterator, spliteratorforEachRemaining, hasNext, next, removeprotected IgniteBiTuple<WALPointer,WALRecord> curRec
protected long curWalSegmIdx
@NotNull protected final @NotNull IgniteLogger log
@NotNull protected final @NotNull GridCacheSharedContext sharedCtx
@NotNull protected final @NotNull FileIOFactory ioFactory
protected AbstractWalRecordsIterator(@NotNull
@NotNull IgniteLogger log,
@NotNull
@NotNull GridCacheSharedContext sharedCtx,
@NotNull
@NotNull RecordSerializerFactory serializerFactory,
@NotNull
@NotNull FileIOFactory ioFactory,
int initialReadBufferSize,
SegmentFileInputFactory segmentFileInputFactory)
log - Logger.sharedCtx - Shared context.serializerFactory - Serializer of current version to read headers.ioFactory - ioFactory for file IO access.initialReadBufferSize - buffer for reading records size.segmentFileInputFactory - Factory to provide I/O interfaces for read primitives with files.protected IgniteBiTuple<WALPointer,WALRecord> onNext() throws IgniteCheckedException
onNext in class GridCloseableIteratorAdapter<IgniteBiTuple<WALPointer,WALRecord>>IgniteCheckedException - If failed.protected boolean onHasNext()
throws IgniteCheckedException
onHasNext in class GridCloseableIteratorAdapter<IgniteBiTuple<WALPointer,WALRecord>>True if iterator has next element.IgniteCheckedException - If failed.protected void onClose()
throws IgniteCheckedException
onClose in class GridCloseableIteratorAdapter<IgniteBiTuple<WALPointer,WALRecord>>IgniteCheckedException - If closing failed.protected void advance()
throws IgniteCheckedException
curRec will be updated.currWalSegment will be updated.advance() runs a step ahead GridIteratorAdapter.next()IgniteCheckedException - If failed.public Optional<WALPointer> lastRead()
lastRead in interface WALIteratorprotected IgniteCheckedException validateTailReachedException(WalSegmentTailReachedException tailReachedException, AbstractWalRecordsIterator.AbstractReadFileHandle currWalSegment)
tailReachedException - Tail reached exception.currWalSegment - Current WAL segment read handler.@Nullable protected @Nullable AbstractWalRecordsIterator.AbstractReadFileHandle closeCurrentWalSegment() throws IgniteCheckedException
IgniteCheckedException - if IO failedprotected abstract AbstractWalRecordsIterator.AbstractReadFileHandle advanceSegment(@Nullable @Nullable AbstractWalRecordsIterator.AbstractReadFileHandle curWalSegment) throws IgniteCheckedException
curWalSegment - current open WAL segment or null if there is no open segment yetIgniteCheckedException - if reading failedprotected IgniteBiTuple<WALPointer,WALRecord> advanceRecord(@Nullable @Nullable AbstractWalRecordsIterator.AbstractReadFileHandle hnd) throws IgniteCheckedException
hnd - currently opened read handle.IgniteCheckedException@NotNull protected @NotNull WALRecord postProcessRecord(@NotNull @NotNull WALRecord rec)
rec - record to post process.protected IgniteCheckedException handleRecordException(@NotNull @NotNull Exception e, @Nullable @Nullable WALPointer ptr)
e - problem from records readingptr - file pointer was accessednull if the error was handled and we can go ahead, IgniteCheckedException if the error
was not handled, and we should stop the iteration.protected AbstractWalRecordsIterator.AbstractReadFileHandle initReadHandle(@NotNull @NotNull AbstractWalRecordsIterator.AbstractFileDescriptor desc, @Nullable @Nullable WALPointer start, @NotNull @NotNull SegmentIO fileIO, @NotNull @NotNull SegmentHeader segmentHeader) throws IgniteCheckedException
desc - File descriptor.start - Optional start pointer. Null means read from the beginning.fileIO - fileIO associated with file descriptorsegmentHeader - read segment header from fileIOIgniteCheckedException - If initialized failed due to another unexpected error.protected AbstractWalRecordsIterator.AbstractReadFileHandle initReadHandle(@NotNull @NotNull AbstractWalRecordsIterator.AbstractFileDescriptor desc, @Nullable @Nullable WALPointer start) throws IgniteCheckedException, FileNotFoundException
desc - File descriptor.start - Optional start pointer. Null means read from the beginningFileNotFoundException - If segment file is missing.IgniteCheckedException - If initialized failed due to another unexpected error.protected abstract AbstractWalRecordsIterator.AbstractReadFileHandle createReadFileHandle(SegmentIO fileIO, RecordSerializer ser, FileInput in)
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.10.0 Release Date : March 10 2021