Class IgniteWalIteratorFactory


  • public class IgniteWalIteratorFactory
    extends Object
    Factory for creating iterator over WAL files
    • 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 files
        IllegalArgumentException - 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 files
        IllegalArgumentException - 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.
      • 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
      • 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