Class Checkpointer
- java.lang.Object
-
- org.apache.ignite.internal.util.worker.GridWorker
-
- org.apache.ignite.internal.processors.cache.persistence.checkpoint.Checkpointer
-
- All Implemented Interfaces:
Runnable,WorkProgressDispatcher
public class Checkpointer extends GridWorker
Checkpointer object is used for notification on checkpoint begin, predicate isscheduledCp.nextCpTs - now > 0. MethodscheduleCheckpoint(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.
-
-
Field Summary
-
Fields inherited from class org.apache.ignite.internal.util.worker.GridWorker
isCancelled, log
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidbody()The implementation should provide the execution body for this runnable.voidcancel()Cancels this runnable.booleancancelOrWaitPartitionDestroy(int grpId, int partId)CheckpointProgresscurrentProgress()IgniteInternalFuture<Void>enableCheckpoints(boolean enable)Deprecated.Should be rewritten to public API.voidfinalizeCheckpointOnRecovery(long cpTs, UUID cpId, WALPointer walPtr, StripedExecutor exec)CheckpointProgressscheduleCheckpoint(long delayFromNow, String reason)<R> CheckpointProgressscheduleCheckpoint(long delayFromNow, String reason, IgniteInClosure<? super IgniteInternalFuture<R>> lsnr)Change the information for a scheduled checkpoint if it was scheduled further thandelayFromNow, or do nothing otherwise.voidschedulePartitionDestroy(@Nullable CacheGroupContext grpCtx, int grpId, int partId)voidshutdownCheckpointer(boolean cancel)voidshutdownNow()Stopping all checkpoint activity immediately even if the current checkpoint is in progress.voidskipCheckpointOnNodeStop(boolean skip)Skip checkpoint on node stop.voidstart()Restart worker in IgniteThread.-
Methods inherited from class org.apache.ignite.internal.util.worker.GridWorker
blockingSectionBegin, blockingSectionEnd, cleanup, heartbeatTs, igniteInstanceName, isCancelled, isDone, join, name, onCancel, onCancelledBeforeWorkerScheduled, onIdle, run, runner, toString, updateHeartbeat
-
-
-
-
Method Detail
-
body
protected void body()
The implementation should provide the execution body for this runnable.- Specified by:
bodyin classGridWorker
-
scheduleCheckpoint
public CheckpointProgress scheduleCheckpoint(long delayFromNow, String reason)
-
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 thandelayFromNow, 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 benullin 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:
Trueif the request to destroy the partition was canceled.- Throws:
IgniteCheckedException
-
cancel
public void cancel()
Cancels this runnable.- Overrides:
cancelin classGridWorker
-
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.
-
finalizeCheckpointOnRecovery
public void finalizeCheckpointOnRecovery(long cpTs, UUID cpId, WALPointer walPtr, StripedExecutor exec) throws IgniteCheckedException- Throws:
IgniteCheckedException- If failed.
-
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- Iftrueskips checkpoint on node stop.
-
-