Packages

c

org.apache.spark.sql.execution.streaming.checkpointing

ChecksumCheckpointFileManager

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.

Linear Supertypes
Logging, CheckpointFileManager, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ChecksumCheckpointFileManager
  2. Logging
  3. CheckpointFileManager
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. 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

  1. implicit class LogStringContext extends AnyRef
    Definition Classes
    Logging

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def MDC(key: LogKey, value: Any): MDC
    Attributes
    protected
    Definition Classes
    Logging
  5. val allowConcurrentDelete: Boolean
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
  8. def close(): Unit
  9. 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 FileAlreadyExistsException in that case.

    Definition Classes
    ChecksumCheckpointFileManagerCheckpointFileManager
  10. 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
    ChecksumCheckpointFileManagerCheckpointFileManager
  11. 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
    ChecksumCheckpointFileManagerCheckpointFileManager
  12. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  14. def exists(path: Path): Boolean

    Whether path exists

    Whether path exists

    Definition Classes
    ChecksumCheckpointFileManagerCheckpointFileManager
  15. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  16. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  17. def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  18. def initializeLogIfNecessary(isInterpreter: Boolean): Unit
    Attributes
    protected
    Definition Classes
    Logging
  19. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  20. 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
    ChecksumCheckpointFileManagerCheckpointFileManager
  21. def isTraceEnabled(): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  22. def list(path: Path): Array[FileStatus]

    List all the files/directories in a path.

    List all the files/directories in a path.

    Definition Classes
    ChecksumCheckpointFileManagerCheckpointFileManager
  23. 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
    ChecksumCheckpointFileManagerCheckpointFileManager
  24. def log: Logger
    Attributes
    protected
    Definition Classes
    Logging
  25. def logBasedOnLevel(level: Level)(f: => MessageWithContext): Unit
    Attributes
    protected
    Definition Classes
    Logging
  26. def logDebug(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  27. def logDebug(entry: LogEntry, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  28. def logDebug(entry: LogEntry): Unit
    Attributes
    protected
    Definition Classes
    Logging
  29. def logDebug(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  30. def logError(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  31. def logError(entry: LogEntry, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  32. def logError(entry: LogEntry): Unit
    Attributes
    protected
    Definition Classes
    Logging
  33. def logError(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  34. def logInfo(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  35. def logInfo(entry: LogEntry, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  36. def logInfo(entry: LogEntry): Unit
    Attributes
    protected
    Definition Classes
    Logging
  37. def logInfo(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  38. def logName: String
    Attributes
    protected
    Definition Classes
    Logging
  39. def logTrace(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  40. def logTrace(entry: LogEntry, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  41. def logTrace(entry: LogEntry): Unit
    Attributes
    protected
    Definition Classes
    Logging
  42. def logTrace(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  43. def logWarning(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  44. def logWarning(entry: LogEntry, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  45. def logWarning(entry: LogEntry): Unit
    Attributes
    protected
    Definition Classes
    Logging
  46. def logWarning(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  47. 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
    ChecksumCheckpointFileManagerCheckpointFileManager
  48. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  49. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  50. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  51. val numThreads: Int
  52. 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
    ChecksumCheckpointFileManagerCheckpointFileManager
  53. val skipCreationIfFileMissingChecksum: Boolean
  54. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  55. def toString(): String
    Definition Classes
    AnyRef → Any
  56. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  57. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  58. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  59. def withLogContext(context: Map[String, String])(body: => Unit): Unit
    Attributes
    protected
    Definition Classes
    Logging

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from Logging

Inherited from CheckpointFileManager

Inherited from AnyRef

Inherited from Any

Ungrouped