Class IgniteWalIteratorFactory
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.persistence.wal.reader.IgniteWalIteratorFactory
-
public class IgniteWalIteratorFactory extends Object
Factory for creating iterator over WAL files
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIgniteWalIteratorFactory.ConsoleLoggerstatic classIgniteWalIteratorFactory.IteratorParametersBuilderWal iterator parameter builder.
-
Constructor Summary
Constructors Constructor Description IgniteWalIteratorFactory()Creates WAL files iterator factory.IgniteWalIteratorFactory(@NotNull IgniteLogger log)Creates WAL files iterator factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<T2<Long,Long>>hasGaps(@NotNull File... filesOrDirs)Find WAL gaps, for example: 0 1 2 3 4 7 8 10 - WAL segment files in directory, this method will return List with two tuples [(4,7),(8,10)].List<T2<Long,Long>>hasGaps(@NotNull String... filesOrDirs)Find WAL gaps, for example: 0 1 2 3 4 7 8 10 - WAL segment files in directory, this method will return List with two tuples [(4,7),(8,10)].List<T2<Long,Long>>hasGaps(@NotNull List<FileDescriptor> descriptors)List<T2<Long,Long>>hasGaps(@NotNull IgniteWalIteratorFactory.IteratorParametersBuilder iteratorParametersBuilder)WALIteratoriterator(@NotNull File... filesOrDirs)Creates iterator for file by file scan mode.WALIteratoriterator(@NotNull String... filesOrDirs)Creates iterator for file by file scan mode.WALIteratoriterator(@NotNull IgniteWalIteratorFactory.IteratorParametersBuilder iteratorParametersBuilder)WALIteratoriterator(@NotNull WALPointer replayFrom, @NotNull File... filesOrDirs)Creates iterator for file by file scan mode.WALIteratoriterator(@NotNull WALPointer replayFrom, @NotNull String... filesOrDirs)Creates iterator for file by file scan mode.List<FileDescriptor>resolveWalFiles(IgniteWalIteratorFactory.IteratorParametersBuilder iteratorParametersBuilder)This methods checks all provided files to be correct WAL segment.
-
-
-
Constructor Detail
-
IgniteWalIteratorFactory
public IgniteWalIteratorFactory()
Creates WAL files iterator factory. WAL iterator supports automatic converting from CacheObjects and KeyCacheObject into BinaryObjects
-
IgniteWalIteratorFactory
public IgniteWalIteratorFactory(@NotNull @NotNull IgniteLogger log)Creates WAL files iterator factory. WAL iterator supports automatic converting from CacheObjects and KeyCacheObject into BinaryObjects- Parameters:
log- Logger.
-
-
Method Detail
-
iterator
public WALIterator iterator(@NotNull @NotNull File... filesOrDirs) throws IgniteCheckedException, IllegalArgumentException
Creates iterator for file by file scan mode. This method may be used for work folder, file indexes are scanned from the file context. In this mode only provided WAL segments will be scanned. New WAL files created during iteration will be ignored.- Parameters:
filesOrDirs- files to scan. A file can be the path to '.wal' file, or directory with '.wal' files. Order is not important, but it is significant to provide all segments without omissions. Path should not contain special symbols. Special symbols should be already masked.- Returns:
- closable WAL records iterator, should be closed when non needed.
- Throws:
IgniteCheckedException- if failed to read filesIllegalArgumentException- If parameter validation failed.
-
iterator
public WALIterator iterator(@NotNull @NotNull WALPointer replayFrom, @NotNull @NotNull File... filesOrDirs) throws IgniteCheckedException, IllegalArgumentException
Creates iterator for file by file scan mode. This method may be used for work folder, file indexes are scanned from the file context. In this mode only provided WAL segments will be scanned. New WAL files created during iteration will be ignored.- Parameters:
replayFrom- File WAL pointer for start replay.filesOrDirs- files to scan. A file can be the path to '.wal' file, or directory with '.wal' files. Order is not important, but it is significant to provide all segments without omissions. Path should not contain special symbols. Special symbols should be already masked.- Returns:
- closable WAL records iterator, should be closed when non needed.
- Throws:
IgniteCheckedException- if failed to read filesIllegalArgumentException- If parameter validation failed.
-
iterator
public WALIterator iterator(@NotNull @NotNull String... filesOrDirs) throws IgniteCheckedException, IllegalArgumentException
Creates iterator for file by file scan mode. This method may be used for work folder, file indexes are scanned from the file context. In this mode only provided WAL segments will be scanned. New WAL files created during iteration will be ignored.- Parameters:
filesOrDirs- paths to scan. A path can be direct to '.wal' file, or directory with '.wal' files. Order is not important, but it is significant to provide all segments without omissions. Path should not contain special symbols. Special symbols should be already masked.- Returns:
- closable WAL records iterator, should be closed when non needed.
- Throws:
IgniteCheckedException- If failed to read files.IllegalArgumentException- If parameter validation failed.
-
iterator
public WALIterator iterator(@NotNull @NotNull WALPointer replayFrom, @NotNull @NotNull String... filesOrDirs) throws IgniteCheckedException, IllegalArgumentException
Creates iterator for file by file scan mode. This method may be used for work folder, file indexes are scanned from the file context. In this mode only provided WAL segments will be scanned. New WAL files created during iteration will be ignored.- Parameters:
replayFrom- File WAL pointer for start replay.filesOrDirs- paths to scan. A path can be direct to '.wal' file, or directory with '.wal' files. Order is not important, but it is significant to provide all segments without omissions. Path should not contain special symbols. Special symbols should be already masked.- Returns:
- closable WAL records iterator, should be closed when non needed.
- Throws:
IgniteCheckedException- If failed to read files.IllegalArgumentException- If parameter validation failed.
-
iterator
public WALIterator iterator(@NotNull @NotNull IgniteWalIteratorFactory.IteratorParametersBuilder iteratorParametersBuilder) throws IgniteCheckedException, IllegalArgumentException
- Parameters:
iteratorParametersBuilder- Iterator parameters builder.- Returns:
- closable WAL records iterator, should be closed when non needed
- Throws:
IgniteCheckedExceptionIllegalArgumentException
-
hasGaps
public List<T2<Long,Long>> hasGaps(@NotNull @NotNull String... filesOrDirs) throws IllegalArgumentException
Find WAL gaps, for example: 0 1 2 3 4 7 8 10 - WAL segment files in directory, this method will return List with two tuples [(4,7),(8,10)].- Parameters:
filesOrDirs- Paths to files or directories for scan.- Returns:
- List of tuples, low and high index segments with gap.
- Throws:
IllegalArgumentException
-
hasGaps
public List<T2<Long,Long>> hasGaps(@NotNull @NotNull File... filesOrDirs) throws IllegalArgumentException
Find WAL gaps, for example: 0 1 2 3 4 7 8 10 - WAL segment files in directory, this method will return List with two tuples [(4,7),(8,10)].- Parameters:
filesOrDirs- Files or directories to scan.- Returns:
- List of tuples, low and high index segments with gap.
- Throws:
IllegalArgumentException
-
hasGaps
public List<T2<Long,Long>> hasGaps(@NotNull @NotNull IgniteWalIteratorFactory.IteratorParametersBuilder iteratorParametersBuilder) throws IllegalArgumentException
- Parameters:
iteratorParametersBuilder- Iterator parameters builder.- Returns:
- List of tuples, low and high index segments with gap.
- Throws:
IllegalArgumentException
-
hasGaps
public List<T2<Long,Long>> hasGaps(@NotNull @NotNull List<FileDescriptor> descriptors) throws IllegalArgumentException
- Parameters:
descriptors- File descriptors.- Returns:
- List of tuples, low and high index segments with gap.
- Throws:
IllegalArgumentException
-
resolveWalFiles
public List<FileDescriptor> resolveWalFiles(IgniteWalIteratorFactory.IteratorParametersBuilder iteratorParametersBuilder)
This methods checks all provided files to be correct WAL segment. Header record and its position is checked. WAL position is used to determine real index. File index from file name is ignored.- Parameters:
iteratorParametersBuilder- IteratorParametersBuilder.- Returns:
- list of file descriptors with checked header records, having correct file index is set
-
-