Class LightweightCheckpointManager


  • public class LightweightCheckpointManager
    extends Object
    Like a sharp checkpoint algorithm implemented in CheckpointManager this checkpoint ensures that all pages marked dirty under checkpointTimeoutLock() will be consistently saved to disk. But unlike CheckpointManager lightweight checkpoint doesn't store any checkpoint markers to disk nor write cp-related records to WAL log. This allows to use it in situations where no recovery is needed after crush in the middle of checkpoint but work can simply be replayed from the beginning. Such situations include defragmentation and node recovery after crush (regular sharp checkpoint cannot be used during recovery).
    • 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 -
      • removeCheckpointListener

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

        public void memoryRecoveryRecordPtr​(WALPointer memoryRecoveryRecordPtr)
        Parameters:
        memoryRecoveryRecordPtr - Memory recovery record pointer.
      • 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.
      • 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.