Class CheckpointManager


  • public class CheckpointManager
    extends Object
    Main class to abstract checkpoint-related processes and actions and hide them from higher-level components. Implements default checkpointing algorithm which is sharp checkpoint but can be replaced by other implementations if needed. Represents only an intermediate step in refactoring of checkpointing component and may change in the future. This checkpoint ensures that all pages marked as dirty under () will be consistently saved to disk. Configuration of this checkpoint allows the following:

    Collecting all pages from configured dataRegions which was marked as dirty under ().

    *

    Marking the start of checkpoint in WAL and on disk.

    Notifying the subscribers of different checkpoint states through CheckpointListener.

    *

    Synchronizing collected pages with disk using FilePageStoreManager.

    Restoring memory in consistent state if the node failed in the middle of checkpoint.

    • Method Detail

      • checkpointTimeoutLock

        public CheckpointTimeoutLock checkpointTimeoutLock()
        Returns:
        Checkpoint lock which can be used for protection of writing to memory.
      • threadBuf

        public void threadBuf​(ThreadLocal<ByteBuffer> threadBuf)
        Replace thread local with buffers. Thread local should provide direct buffer with one page in length.
        Parameters:
        threadBuf - new thread-local with buffers for the checkpoint threads.
      • addCheckpointListener

        public void addCheckpointListener​(CheckpointListener lsnr,
                                          DataRegion dataRegion)
        Parameters:
        lsnr - Listener.
        dataRegion - Data region for which listener is corresponded to.
      • removeCheckpointListener

        public void removeCheckpointListener​(CheckpointListener lsnr)
        Parameters:
        lsnr - Listener.
      • memoryRecoveryRecordPtr

        public void memoryRecoveryRecordPtr​(WALPointer memoryRecoveryRecordPtr)
        Parameters:
        memoryRecoveryRecordPtr - Memory recovery record pointer.
      • checkpointDirectory

        public File checkpointDirectory()
        Returns:
        Checkpoint directory.
      • forceCheckpoint

        public <R> CheckpointProgress forceCheckpoint​(String reason,
                                                      IgniteInClosure<? super IgniteInternalFuture<R>> lsnr)
        Start the new checkpoint immediately.
        Parameters:
        reason - Reason.
        lsnr - Listener which will be called on finish.
        Returns:
        Triggered checkpoint progress.
      • checkpointHistory

        public CheckpointHistory checkpointHistory()
        Returns:
        Checkpoint history.
      • getCheckpointer

        public Checkpointer getCheckpointer()
        Current checkpointer implementation.
      • schedulePartitionDestroy

        public void schedulePartitionDestroy​(@Nullable
                                             @Nullable CacheGroupContext context,
                                             int groupId,
                                             int partId)
        Parameters:
        context - Group context. Can be null in case of crash recovery.
        groupId - Group ID.
        partId - Partition ID.
      • cancelOrWaitPartitionDestroy

        public boolean cancelOrWaitPartitionDestroy​(int grpId,
                                                    int partId)
                                             throws IgniteCheckedException
        Parameters:
        grpId - Group ID.
        partId - Partition ID.
        Returns:
        True if the request to destroy the partition was canceled.
        Throws:
        IgniteCheckedException
      • stop

        public void stop​(boolean cancel)
        Parameters:
        cancel - Cancel flag.
      • init

        public void init()
        Initialize the checkpoint and prepare it to work. It should be called if the stop was called before.
      • start

        public void start()
        Checkpoint starts to do their work after this method.
      • unblockCheckpointLock

        public void unblockCheckpointLock()
        Checkpoint lock blocks when stop method is called. This method allows continuing the work with a checkpoint lock if needed.