Class LightweightCheckpointManager
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.persistence.checkpoint.LightweightCheckpointManager
-
public class LightweightCheckpointManager extends Object
Like a sharp checkpoint algorithm implemented inCheckpointManagerthis checkpoint ensures that all pages marked dirty undercheckpointTimeoutLock()will be consistently saved to disk. But unlikeCheckpointManagerlightweight 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).
-
-
Constructor Summary
Constructors Constructor Description LightweightCheckpointManager(Function<Class<?>,IgniteLogger> logger, String igniteInstanceName, String checkpointThreadName, WorkersRegistry workersRegistry, DataStorageConfiguration persistenceCfg, Supplier<Collection<DataRegion>> dataRegions, IgniteThrowableFunction<Integer,PageMemoryEx> pageMemoryGroupResolver, PageMemoryImpl.ThrottlingPolicy throttlingPolicy, DataStorageMetricsImpl persStoreMetrics, LongJVMPauseDetector longJvmPauseDetector, FailureProcessor failureProcessor, GridCacheProcessor cacheProcessor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCheckpointListener(CheckpointListener lsnr, DataRegion dataRegion)booleancancelOrWaitPartitionDestroy(int grpId, int partId)CheckpointTimeoutLockcheckpointTimeoutLock()IgniteInternalFuture<Void>enableCheckpoints(boolean enable)For test use only.voidfinalizeCheckpointOnRecovery(long ts, UUID id, WALPointer ptr, StripedExecutor exec)<R> CheckpointProgressforceCheckpoint(String reason, IgniteInClosure<? super IgniteInternalFuture<R>> lsnr)Start the new checkpoint immediately.CheckpointergetCheckpointer()voidinit()Initialize the checkpoint and prepare it to work.voidmemoryRecoveryRecordPtr(WALPointer memoryRecoveryRecordPtr)voidremoveCheckpointListener(CheckpointListener lsnr)voidschedulePartitionDestroy(@Nullable CacheGroupContext context, int groupId, int partId)voidstart()Checkpoint starts to do their work after this method.voidstop(boolean cancel)voidthreadBuf(ThreadLocal<ByteBuffer> threadBuf)Replace thread local with buffers.voidunblockCheckpointLock()Checkpoint lock blocks when stop method is called.
-
-
-
Constructor Detail
-
LightweightCheckpointManager
public LightweightCheckpointManager(Function<Class<?>,IgniteLogger> logger, String igniteInstanceName, String checkpointThreadName, WorkersRegistry workersRegistry, DataStorageConfiguration persistenceCfg, Supplier<Collection<DataRegion>> dataRegions, IgniteThrowableFunction<Integer,PageMemoryEx> pageMemoryGroupResolver, PageMemoryImpl.ThrottlingPolicy throttlingPolicy, DataStorageMetricsImpl persStoreMetrics, LongJVMPauseDetector longJvmPauseDetector, FailureProcessor failureProcessor, GridCacheProcessor cacheProcessor)
- Parameters:
logger- Logger producer.igniteInstanceName- Ignite instance name.checkpointThreadName- Name of main checkpoint thread.workersRegistry- Workers registry.persistenceCfg- Persistence configuration.dataRegions- Data regions.pageMemoryGroupResolver- Page memory resolver.throttlingPolicy- Throttling policy.persStoreMetrics- Persistence metrics.longJvmPauseDetector- Long JVM pause detector.failureProcessor- Failure processor.cacheProcessor- Cache processor.
-
-
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.
-
getCheckpointer
public Checkpointer getCheckpointer()
-
schedulePartitionDestroy
public void schedulePartitionDestroy(@Nullable @Nullable CacheGroupContext context, int groupId, int partId)- Parameters:
context- Group context. Can benullin case of crash recovery.groupId- Group ID.partId- Partition ID.
-
enableCheckpoints
public IgniteInternalFuture<Void> enableCheckpoints(boolean enable)
For test use only.
-
finalizeCheckpointOnRecovery
public void finalizeCheckpointOnRecovery(long ts, UUID id, WALPointer ptr, StripedExecutor exec) throws IgniteCheckedException- Throws:
IgniteCheckedException- If failed.
-
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
-
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.
-
-