Class Checkpointer

  • All Implemented Interfaces:
    Runnable, WorkProgressDispatcher

    public class Checkpointer
    extends GridWorker
    Checkpointer object is used for notification on checkpoint begin, predicate is scheduledCp.nextCpTs - now > 0 . Method scheduleCheckpoint(long, java.lang.String) uses notify, waitCheckpointEvent() uses wait. Checkpointer is one threaded which means that only one checkpoint at the one moment possible. Responsiblity: Provide the API for schedule/trigger the checkpoint. Schedule new checkpoint after current one according to checkpoint frequency. Failure handling. Managing of page write threads - ? Logging and metrics of checkpoint. * Checkpointer steps:

    Awaiting checkpoint event.

    Collect all dirty pages from page memory under write lock.

    Start to write dirty pages to disk.

    Finish the checkpoint and write end marker to disk.

    • Method Detail

      • body

        protected void body()
        The implementation should provide the execution body for this runnable.
        Specified by:
        body in class GridWorker
      • scheduleCheckpoint

        public <R> CheckpointProgress scheduleCheckpoint​(long delayFromNow,
                                                         String reason,
                                                         IgniteInClosure<? super IgniteInternalFuture<R>> lsnr)
        Change the information for a scheduled checkpoint if it was scheduled further than delayFromNow, or do nothing otherwise. If lsnr is not null, new checkpoint is always triggered.
        Returns:
        Nearest scheduled checkpoint which is not started yet(Dirty pages weren't collected yet).
      • schedulePartitionDestroy

        public void schedulePartitionDestroy​(@Nullable
                                             @Nullable CacheGroupContext grpCtx,
                                             int grpId,
                                             int partId)
        Parameters:
        grpCtx - Group context. Can be null in case of crash recovery.
        grpId - 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
      • cancel

        public void cancel()
        Cancels this runnable.
        Overrides:
        cancel in class GridWorker
      • enableCheckpoints

        public IgniteInternalFuture<Void> enableCheckpoints​(boolean enable)
        Deprecated.
        Should be rewritten to public API.
        For test use only.
      • shutdownNow

        public void shutdownNow()
        Stopping all checkpoint activity immediately even if the current checkpoint is in progress.
      • start

        public void start()
        Restart worker in IgniteThread.
      • shutdownCheckpointer

        public void shutdownCheckpointer​(boolean cancel)
        Parameters:
        cancel - Cancel flag.
      • currentProgress

        public CheckpointProgress currentProgress()
        Returns:
        Progress of current chekpoint, last finished one or null, if checkpoint has never started.
      • skipCheckpointOnNodeStop

        public void skipCheckpointOnNodeStop​(boolean skip)
        Skip checkpoint on node stop.
        Parameters:
        skip - If true skips checkpoint on node stop.