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
public class WithinCheckpointFileMergingSnapshotManager extends FileMergingSnapshotManagerBase
AFileMergingSnapshotManager
that merging files within a checkpoint.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.flink.runtime.checkpoint.filemerging.FileMergingSnapshotManagerBase
FileMergingSnapshotManagerBase.DirectoryHandleWithReferenceTrack
-
Nested 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
Constructors Constructor Description WithinCheckpointFileMergingSnapshotManager(String id, long maxFileSize, PhysicalFilePool.Type filePoolType, float maxSpaceAmplification, Executor ioExecutor, org.apache.flink.metrics.MetricGroup metricGroup)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
protected void
discardCheckpoint(long checkpointId)
The callback which will be triggered when all subtasks discarded (aborted or subsumed).protected PhysicalFile
getOrCreatePhysicalFileForCheckpoint(FileMergingSnapshotManager.SubtaskKey subtaskKey, long checkpointId, CheckpointedStateScope scope)
Get a reused physical file or create one.void
notifyCheckpointAborted(FileMergingSnapshotManager.SubtaskKey subtaskKey, long checkpointId)
This method is called as a notification once a distributed checkpoint has been aborted.void
notifyCheckpointComplete(FileMergingSnapshotManager.SubtaskKey subtaskKey, long checkpointId)
Notifies the manager that the checkpoint with the givencheckpointId
completed and was committed.protected void
returnPhysicalFileForNextReuse(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 Detail
-
WithinCheckpointFileMergingSnapshotManager
public WithinCheckpointFileMergingSnapshotManager(String id, long maxFileSize, PhysicalFilePool.Type filePoolType, float maxSpaceAmplification, Executor ioExecutor, org.apache.flink.metrics.MetricGroup metricGroup)
-
-
Method Detail
-
notifyCheckpointComplete
public void notifyCheckpointComplete(FileMergingSnapshotManager.SubtaskKey subtaskKey, long checkpointId) throws Exception
Description copied from interface:FileMergingSnapshotManager
Notifies the manager that the checkpoint with the givencheckpointId
completed and was committed.- Specified by:
notifyCheckpointComplete
in interfaceFileMergingSnapshotManager
- Overrides:
notifyCheckpointComplete
in 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:FileMergingSnapshotManager
This method is called as a notification once a distributed checkpoint has been aborted.- Specified by:
notifyCheckpointAborted
in interfaceFileMergingSnapshotManager
- Overrides:
notifyCheckpointAborted
in 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:FileMergingSnapshotManagerBase
Get 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:
getOrCreatePhysicalFileForCheckpoint
in 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:FileMergingSnapshotManagerBase
Try 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:
returnPhysicalFileForNextReuse
in 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:
FileMergingSnapshotManagerBase.getOrCreatePhysicalFileForCheckpoint(SubtaskKey, long, CheckpointedStateScope)
-
discardCheckpoint
protected void discardCheckpoint(long checkpointId) throws IOException
Description copied from class:FileMergingSnapshotManagerBase
The callback which will be triggered when all subtasks discarded (aborted or subsumed).- Overrides:
discardCheckpoint
in classFileMergingSnapshotManagerBase
- Parameters:
checkpointId
- the discarded checkpoint id.- Throws:
IOException
- if anything goes wrong with file system.
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFileMergingSnapshotManagerBase
- Throws:
IOException
-
-