class ChecksumCheckpointFileManager extends CheckpointFileManager with Logging
A CheckpointFileManager that creates a checksum file for the main file. This wraps another CheckpointFileManager and adds checksum functionality on top of it. Under the hood, when a file is created, it also creates a checksum file with the same name as the main file but adds a suffix. It returns ChecksumCancellableFSDataOutputStream which handles the writing of the main file and checksum file.
When a file is opened, it returns ChecksumFSDataInputStream, which handles reading the main file and checksum file and does the checksum verification.
In order to reduce the impact of reading/writing 2 files instead of 1, it uses a threadpool to read/write both files concurrently.
- Note
It is able to read files written by other CheckpointFileManager, that don't have checksum. It automatically deletes the checksum file when the main file is deleted. If you delete the main file with a different type of manager, then the checksum file will be left behind (i.e. orphan checksum file), since they don't know about it. It would be your responsibility to delete the orphan checksum files.
- Alphabetic
- By Inheritance
- ChecksumCheckpointFileManager
- Logging
- CheckpointFileManager
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new ChecksumCheckpointFileManager(underlyingFileMgr: CheckpointFileManager, allowConcurrentDelete: Boolean = false, numThreads: Int, skipCreationIfFileMissingChecksum: Boolean)
- underlyingFileMgr
The file manager to use under the hood
- allowConcurrentDelete
If true, allows deleting the main and checksum file concurrently. This is a perf optimization, but can potentially lead to orphan checksum files. If using this, it is your responsibility to clean up the potential orphan checksum files.
- numThreads
This is the number of threads to use for the thread pool, for reading/writing files. To avoid blocking, if the file manager instance is being used by a single thread, then you can set this to 2 (one thread for main file, another for checksum file). If file manager is shared by multiple threads, you can set it to number of threads using file manager * 2. Setting this differently can lead to file operation being blocked waiting for a free thread.
- skipCreationIfFileMissingChecksum
(ES-1629547): If true, when a file already exists but its checksum file does not exist, fall back to using the underlying file manager directly instead of creating with checksum. This is useful for compatibility with files created before checksums were enabled. Consider the case when a batch fails but state files are written. If on the next run, we try to upload both a new file and a checksum file, the file could fail to be uploaded but the checksum file is uploaded successfully. This would lead to a situation where the old file could be loaded and compared with the new file checksum, which would fail the checksum verification.
Type Members
- implicit class LogStringContext extends AnyRef
- Definition Classes
- Logging
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def MDC(key: LogKey, value: Any): MDC
- Attributes
- protected
- Definition Classes
- Logging
- val allowConcurrentDelete: Boolean
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- def close(): Unit
- Definition Classes
- ChecksumCheckpointFileManager → CheckpointFileManager
- def createAtomic(path: Path, overwriteIfPossible: Boolean): CancellableFSDataOutputStream
Create a file and make its contents available atomically after the output stream is closed.
Create a file and make its contents available atomically after the output stream is closed.
- path
Path to create
- overwriteIfPossible
If true, then the implementations must do a best-effort attempt to overwrite the file if it already exists. It should not throw any exception if the file exists. However, if false, then the implementation must not overwrite if the file already exists and must throw
FileAlreadyExistsExceptionin that case.
- Definition Classes
- ChecksumCheckpointFileManager → CheckpointFileManager
- def createCheckpointDirectory(): Path
Creates the checkpoint path if it does not exist, and returns the qualified checkpoint path.
Creates the checkpoint path if it does not exist, and returns the qualified checkpoint path.
- Definition Classes
- ChecksumCheckpointFileManager → CheckpointFileManager
- def delete(path: Path): Unit
Recursively delete a path if it exists.
Recursively delete a path if it exists. Should not throw exception if file doesn't exist.
- Definition Classes
- ChecksumCheckpointFileManager → CheckpointFileManager
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def exists(path: Path): Boolean
Whether path exists
Whether path exists
- Definition Classes
- ChecksumCheckpointFileManager → CheckpointFileManager
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean): Boolean
- Attributes
- protected
- Definition Classes
- Logging
- def initializeLogIfNecessary(isInterpreter: Boolean): Unit
- Attributes
- protected
- Definition Classes
- Logging
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isLocal: Boolean
Is the default file system this implementation is operating on the local file system.
Is the default file system this implementation is operating on the local file system.
- Definition Classes
- ChecksumCheckpointFileManager → CheckpointFileManager
- def isTraceEnabled(): Boolean
- Attributes
- protected
- Definition Classes
- Logging
- def list(path: Path): Array[FileStatus]
List all the files/directories in a path.
List all the files/directories in a path.
- Definition Classes
- ChecksumCheckpointFileManager → CheckpointFileManager
- def list(path: Path, filter: PathFilter): Array[FileStatus]
List the files/directories in a path that match a filter.
List the files/directories in a path that match a filter.
- Definition Classes
- ChecksumCheckpointFileManager → CheckpointFileManager
- def log: Logger
- Attributes
- protected
- Definition Classes
- Logging
- def logBasedOnLevel(level: Level)(f: => MessageWithContext): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logDebug(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logDebug(entry: LogEntry, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logDebug(entry: LogEntry): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logDebug(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logError(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logError(entry: LogEntry, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logError(entry: LogEntry): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logError(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logInfo(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logInfo(entry: LogEntry, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logInfo(entry: LogEntry): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logInfo(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logName: String
- Attributes
- protected
- Definition Classes
- Logging
- def logTrace(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logTrace(entry: LogEntry, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logTrace(entry: LogEntry): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logTrace(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logWarning(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logWarning(entry: LogEntry, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logWarning(entry: LogEntry): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logWarning(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def mkdirs(path: Path): Unit
Make directory at the give path and all its parent directories as needed.
Make directory at the give path and all its parent directories as needed.
- Definition Classes
- ChecksumCheckpointFileManager → CheckpointFileManager
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- val numThreads: Int
- def open(path: Path): FSDataInputStream
Open a file for reading, or throw exception if it does not exist.
Open a file for reading, or throw exception if it does not exist.
- Definition Classes
- ChecksumCheckpointFileManager → CheckpointFileManager
- val skipCreationIfFileMissingChecksum: Boolean
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def withLogContext(context: Map[String, String])(body: => Unit): Unit
- Attributes
- protected
- Definition Classes
- Logging
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)