Interface IgniteWriteAheadLogManager

    • Method Detail

      • isAlwaysWriteFullPages

        boolean isAlwaysWriteFullPages()
        Returns:
        true If we have to always write full pages.
      • isFullSync

        boolean isFullSync()
        Returns:
        true if WAL will perform fair syncs on fsync call.
      • serializerVersion

        int serializerVersion()
        Returns:
        Current serializer version.
      • resumeLogging

        void resumeLogging​(WALPointer lastWrittenPtr)
                    throws IgniteCheckedException
        Resumes logging after start. When WAL manager is started, it will skip logging any updates until this method is called to avoid logging changes induced by the state restore procedure.
        Throws:
        IgniteCheckedException - If fails.
      • flush

        WALPointer flush​(WALPointer ptr,
                         boolean explicitFsync)
                  throws IgniteCheckedException,
                         StorageException
        Makes sure that all log entries written to the log up until the specified pointer are actually written to the underlying storage.
        Parameters:
        ptr - Optional pointer to write. If null, will sync up to the latest record.
        explicitFsync - If true, data will be synced to the storage device on hardware level.
        Returns:
        Last WAL position which was flushed to WAL segment file. May be greater than or equal to a ptr. May be null, it means nothing has been flushed.
        Throws:
        IgniteCheckedException - If failed to write.
        StorageException - If IO exception occurred during the write. If an exception is thrown from this method, the WAL will be invalidated and the node will be stopped.
      • reserve

        boolean reserve​(WALPointer start)
        Invoke this method to reserve WAL history since provided pointer and prevent it's deletion. NOTE: If the DataStorageConfiguration.getMaxWalArchiveSize() is exceeded, the segment will be released.
        Parameters:
        start - WAL pointer.
        Returns:
        True if the reservation was successful.
      • release

        void release​(WALPointer start)
        Invoke this method to release WAL history since provided pointer that was previously reserved.
        Parameters:
        start - WAL pointer.
      • truncate

        int truncate​(@Nullable
                     @Nullable WALPointer high)
        Gives a hint to WAL manager to clear entries logged before the given pointer. If entries are needed for binary recovery, they will not be affected. Some entries may be reserved eg for historical rebalance and they also will not be affected.
        Parameters:
        high - Upper border to which WAL segments will be deleted.
        Returns:
        Number of deleted WAL segments.
      • notchLastCheckpointPtr

        void notchLastCheckpointPtr​(WALPointer ptr)
        Notifies this about latest checkpoint pointer.

        Current implementations, in fact, react by keeping all WAL segments uncompacted starting from index prior to the index of ptr. Compaction implies filtering out physical records and ZIP compression.

        Parameters:
        ptr - Pointer for which it is safe to compact the log.
      • currentSegment

        long currentSegment()
        Returns:
        Current segment index.
      • walArchiveSegments

        int walArchiveSegments()
        Returns:
        Total number of segments in the WAL archive.
      • lastArchivedSegment

        long lastArchivedSegment()
        Returns:
        Last archived segment index.
      • lastCompactedSegment

        long lastCompactedSegment()
        Returns:
        Last compacted segment index.
      • reserved

        boolean reserved​(WALPointer ptr)
        Checks if WAL segment is under lock or reserved
        Parameters:
        ptr - Pointer to check.
        Returns:
        True if given pointer is located in reserved segment.
      • reserved

        int reserved​(WALPointer low,
                     WALPointer high)
        Checks if WAL segments is under lock or reserved.
        Parameters:
        low - Pointer since which WAL is locked or reserved. If null, checks from the oldest segment.
        high - Pointer for which WAL is locked or reserved.
        Returns:
        Number of reserved WAL segments.
      • disabled

        boolean disabled​(int grpId,
                         long pageId)
        Checks WAL disabled for cache group.
        Parameters:
        grpId - Group id.
        pageId - Page id.
      • segmentSize

        long segmentSize​(long idx)
        Getting local WAL segment size.
        Parameters:
        idx - Absolute segment index.
        Returns:
        Segment size, 0 if size is unknown.
      • lastWritePointer

        WALPointer lastWritePointer()
        Get last written pointer.
        Returns:
        Last written pointer.
      • archiveDir

        @Nullable
        @Nullable File archiveDir()
        Archive directory if any.
        Returns:
        Archive directory.
      • compactedSegment

        @Nullable
        @Nullable File compactedSegment​(long idx)
        Parameters:
        idx - Segment index.
        Returns:
        Compressed archive segment.