Class WithinCheckpointFileMergingSnapshotManager
java.lang.Object
org.apache.flink.runtime.checkpoint.filemerging.FileMergingSnapshotManagerBase
org.apache.flink.runtime.checkpoint.filemerging.WithinCheckpointFileMergingSnapshotManager
- All Implemented Interfaces:
Closeable,AutoCloseable,FileMergingSnapshotManager
A
FileMergingSnapshotManager that merging files within a checkpoint.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.flink.runtime.checkpoint.filemerging.FileMergingSnapshotManagerBase
FileMergingSnapshotManagerBase.DirectoryHandleWithReferenceTrackNested classes/interfaces inherited from interface org.apache.flink.runtime.checkpoint.filemerging.FileMergingSnapshotManager
FileMergingSnapshotManager.SpaceStat, FileMergingSnapshotManager.SubtaskKey -
Field Summary
Fields inherited from class org.apache.flink.runtime.checkpoint.filemerging.FileMergingSnapshotManagerBase
checkpointDir, filePoolType, fs, ioExecutor, lock, managedExclusiveStateDir, managedExclusiveStateDirHandle, maxPhysicalFileSize, maxSpaceAmplification, metricGroup, physicalFileDeleter, sharedStateDir, shouldSyncAfterClosingLogicalFile, spaceStat, taskOwnedStateDir, uploadedStates, writeBufferSize -
Constructor Summary
ConstructorsConstructorDescriptionWithinCheckpointFileMergingSnapshotManager(String id, long maxFileSize, PhysicalFilePool.Type filePoolType, float maxSpaceAmplification, Executor ioExecutor, org.apache.flink.metrics.MetricGroup metricGroup) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected voiddiscardCheckpoint(long checkpointId) The callback which will be triggered when all subtasks discarded (aborted or subsumed).protected PhysicalFilegetOrCreatePhysicalFileForCheckpoint(FileMergingSnapshotManager.SubtaskKey subtaskKey, long checkpointId, CheckpointedStateScope scope) Get a reused physical file or create one.voidnotifyCheckpointAborted(FileMergingSnapshotManager.SubtaskKey subtaskKey, long checkpointId) This method is called as a notification once a distributed checkpoint has been aborted.voidnotifyCheckpointComplete(FileMergingSnapshotManager.SubtaskKey subtaskKey, long checkpointId) Notifies the manager that the checkpoint with the givencheckpointIdcompleted and was committed.protected voidreturnPhysicalFileForNextReuse(FileMergingSnapshotManager.SubtaskKey subtaskKey, long checkpointId, PhysicalFile physicalFile) Try to return an existing physical file to the manager for next reuse.Methods inherited from class org.apache.flink.runtime.checkpoint.filemerging.FileMergingSnapshotManagerBase
couldReusePreviousStateHandle, createCheckpointStateOutputStream, createLogicalFile, createPhysicalFile, createPhysicalPool, deletePhysicalFile, discardSingleLogicalFile, generatePhysicalFilePath, getId, getLogicalFile, getManagedDir, getManagedDirStateHandle, initFileSystem, notifyCheckpointStart, notifyCheckpointSubsumed, registerSubtaskForSharedStates, restoreStateHandles, reusePreviousStateHandle, unregisterSubtask
-
Constructor Details
-
WithinCheckpointFileMergingSnapshotManager
public WithinCheckpointFileMergingSnapshotManager(String id, long maxFileSize, PhysicalFilePool.Type filePoolType, float maxSpaceAmplification, Executor ioExecutor, org.apache.flink.metrics.MetricGroup metricGroup)
-
-
Method Details
-
notifyCheckpointComplete
public void notifyCheckpointComplete(FileMergingSnapshotManager.SubtaskKey subtaskKey, long checkpointId) throws Exception Description copied from interface:FileMergingSnapshotManagerNotifies the manager that the checkpoint with the givencheckpointIdcompleted and was committed.- Specified by:
notifyCheckpointCompletein interfaceFileMergingSnapshotManager- Overrides:
notifyCheckpointCompletein classFileMergingSnapshotManagerBase- Parameters:
subtaskKey- the subtask key identifying the subtask.checkpointId- The ID of the checkpoint that has been completed.- Throws:
Exception- thrown if anything goes wrong with the listener.
-
notifyCheckpointAborted
public void notifyCheckpointAborted(FileMergingSnapshotManager.SubtaskKey subtaskKey, long checkpointId) throws Exception Description copied from interface:FileMergingSnapshotManagerThis method is called as a notification once a distributed checkpoint has been aborted.- Specified by:
notifyCheckpointAbortedin interfaceFileMergingSnapshotManager- Overrides:
notifyCheckpointAbortedin classFileMergingSnapshotManagerBase- Parameters:
subtaskKey- the subtask key identifying the subtask.checkpointId- The ID of the checkpoint that has been completed.- Throws:
Exception- thrown if anything goes wrong with the listener.
-
getOrCreatePhysicalFileForCheckpoint
@Nonnull protected PhysicalFile getOrCreatePhysicalFileForCheckpoint(FileMergingSnapshotManager.SubtaskKey subtaskKey, long checkpointId, CheckpointedStateScope scope) throws IOException Description copied from class:FileMergingSnapshotManagerBaseGet a reused physical file or create one. This will be called in checkpoint output stream creation logic.Basic logic of file reusing: whenever a physical file is needed, this method is called with necessary information provided for acquiring a file. The file will not be reused until it is written and returned to the reused pool by calling
FileMergingSnapshotManagerBase.returnPhysicalFileForNextReuse(org.apache.flink.runtime.checkpoint.filemerging.FileMergingSnapshotManager.SubtaskKey, long, org.apache.flink.runtime.checkpoint.filemerging.PhysicalFile).- Specified by:
getOrCreatePhysicalFileForCheckpointin classFileMergingSnapshotManagerBase- Parameters:
subtaskKey- the subtask key for the callercheckpointId- the checkpoint idscope- checkpoint scope- Returns:
- the requested physical file.
- Throws:
IOException- thrown if anything goes wrong with file system.
-
returnPhysicalFileForNextReuse
protected void returnPhysicalFileForNextReuse(FileMergingSnapshotManager.SubtaskKey subtaskKey, long checkpointId, PhysicalFile physicalFile) throws IOException Description copied from class:FileMergingSnapshotManagerBaseTry to return an existing physical file to the manager for next reuse. If this physical file is no longer needed (for reusing), it will be closed.Basic logic of file reusing, see
FileMergingSnapshotManagerBase.getOrCreatePhysicalFileForCheckpoint(org.apache.flink.runtime.checkpoint.filemerging.FileMergingSnapshotManager.SubtaskKey, long, org.apache.flink.runtime.state.CheckpointedStateScope).- Specified by:
returnPhysicalFileForNextReusein classFileMergingSnapshotManagerBase- Parameters:
subtaskKey- the subtask key for the callercheckpointId- in which checkpoint this physical file is requested.physicalFile- the returning checkpoint- Throws:
IOException- thrown if anything goes wrong with file system.- See Also:
-
discardCheckpoint
Description copied from class:FileMergingSnapshotManagerBaseThe callback which will be triggered when all subtasks discarded (aborted or subsumed).- Overrides:
discardCheckpointin classFileMergingSnapshotManagerBase- Parameters:
checkpointId- the discarded checkpoint id.- Throws:
IOException- if anything goes wrong with file system.
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFileMergingSnapshotManagerBase- Throws:
IOException
-