Packages

class OffsetSeqLog extends HDFSMetadataLog[OffsetSeq]

This class is used to log offsets to persistent files in HDFS. Each file corresponds to a specific batch of offsets. The file format contains a version string in the first line, followed by a the JSON string representation of the offsets separated by a newline character. If a source offset is missing, then that line will contain a string value defined in the SERIALIZED_VOID_OFFSET variable in OffsetSeqLog companion object. For instance, when dealing with LongOffset types: v1 // version 1 metadata {0} // LongOffset 0 {3} // LongOffset 3

  • // No offset for this source i.e., an invalid JSON string {2} // LongOffset 2 ...
Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. OffsetSeqLog
  2. HDFSMetadataLog
  3. Logging
  4. MetadataLog
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new OffsetSeqLog(sparkSession: SparkSession, path: String)

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 add(batchId: Long, metadata: OffsetSeq): Boolean

    Store the metadata for the specified batchId and return true if successful.

    Store the metadata for the specified batchId and return true if successful. If the batchId's metadata has already been stored, this method will return false.

    Definition Classes
    HDFSMetadataLogMetadataLog
  5. def addNewBatchByStream(batchId: Long)(fn: (OutputStream) ⇒ Unit): Boolean

    Store the metadata for the specified batchId and return true if successful.

    Store the metadata for the specified batchId and return true if successful. This method fills the content of metadata via executing function. If the function throws an exception, writing will be automatically cancelled and this method will propagate the exception.

    If the batchId's metadata has already been stored, this method will return false.

    Writing the metadata is done by writing a batch to a temp file then rename it to the batch file.

    There may be multiple HDFSMetadataLog using the same metadata path. Although it is not a valid behavior, we still need to prevent it from destroying the files.

    Definition Classes
    HDFSMetadataLog
  6. def applyFnToBatchByStream[RET](batchId: Long, skipExistingCheck: Boolean = false)(fn: (InputStream) ⇒ RET): RET

    Apply provided function to each entry in the specific batch metadata log.

    Apply provided function to each entry in the specific batch metadata log.

    Unlike get which will materialize all entries into memory, this method streamlines the process via READ-AND-PROCESS. This helps to avoid the memory issue on huge metadata log file.

    NOTE: This no longer fails early on corruption. The caller should handle the exception properly and make sure the logic is not affected by failing in the middle.

    Definition Classes
    HDFSMetadataLog
  7. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  8. val batchCache: Map[Long, OffsetSeq]

    Cache the latest two batches.

    Cache the latest two batches. StreamExecution usually just accesses the latest two batches when committing offsets, this cache will save some file system operations.

    Attributes
    protected[sql]
    Definition Classes
    HDFSMetadataLog
  9. val batchFilesFilter: PathFilter

    A PathFilter to filter only batch files

    A PathFilter to filter only batch files

    Attributes
    protected
    Definition Classes
    HDFSMetadataLog
  10. def batchIdToPath(batchId: Long): Path
    Attributes
    protected
    Definition Classes
    HDFSMetadataLog
  11. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  12. def deserialize(in: InputStream): OffsetSeq

    Read and deserialize the metadata from input stream.

    Read and deserialize the metadata from input stream. If this method is overridden in a subclass, the overriding method should not close the given input stream, as it will be closed in the caller.

    Attributes
    protected
    Definition Classes
    OffsetSeqLogHDFSMetadataLog
  13. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  15. val fileManager: CheckpointFileManager
    Attributes
    protected
    Definition Classes
    HDFSMetadataLog
  16. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  17. def get(startId: Option[Long], endId: Option[Long]): Array[(Long, OffsetSeq)]

    Return metadata for batches between startId (inclusive) and endId (inclusive).

    Return metadata for batches between startId (inclusive) and endId (inclusive). If startId is None, just return all batches before endId (inclusive).

    Definition Classes
    HDFSMetadataLogMetadataLog
  18. def get(batchId: Long): Option[OffsetSeq]

    Return the metadata for the specified batchId if it's stored.

    Return the metadata for the specified batchId if it's stored. Otherwise, return None.

    Definition Classes
    HDFSMetadataLogMetadataLog
  19. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  20. def getLatest(): Option[(Long, OffsetSeq)]

    Return the latest batch Id and its metadata if exist.

    Return the latest batch Id and its metadata if exist.

    Definition Classes
    HDFSMetadataLogMetadataLog
  21. def getLatestBatchId(): Option[Long]

    Return the latest batch id without reading the file.

    Return the latest batch id without reading the file.

    Definition Classes
    HDFSMetadataLog
  22. def getOrderedBatchFiles(): Array[FileStatus]

    Get an array of [FileStatus] referencing batch files.

    Get an array of [FileStatus] referencing batch files. The array is sorted by most recent batch file first to oldest batch file.

    Definition Classes
    HDFSMetadataLog
  23. def getPrevBatchFromStorage(batchId: Long): Option[Long]

    Get the id of the previous batch from storage

    Get the id of the previous batch from storage

    batchId

    get the previous batch id of this batch with batchId

    Definition Classes
    HDFSMetadataLog
  24. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  25. def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  26. def initializeLogIfNecessary(isInterpreter: Boolean): Unit
    Attributes
    protected
    Definition Classes
    Logging
  27. def isBatchFile(path: Path): Boolean
    Attributes
    protected
    Definition Classes
    HDFSMetadataLog
  28. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  29. def isTraceEnabled(): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  30. def listBatches: Array[Long]

    List the available batches on file system.

    List the available batches on file system.

    Attributes
    protected
    Definition Classes
    HDFSMetadataLog
  31. def listBatchesOnDisk: Array[Long]

    List the batches persisted to storage

    List the batches persisted to storage

    returns

    array of batches ids

    Definition Classes
    HDFSMetadataLog
  32. def log: Logger
    Attributes
    protected
    Definition Classes
    Logging
  33. def logDebug(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  34. def logDebug(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  35. def logError(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  36. def logError(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  37. def logInfo(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  38. def logInfo(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  39. def logName: String
    Attributes
    protected
    Definition Classes
    Logging
  40. def logTrace(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  41. def logTrace(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  42. def logWarning(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  43. def logWarning(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  44. val metadataCacheEnabled: Boolean
    Attributes
    protected
    Definition Classes
    HDFSMetadataLog
  45. val metadataPath: Path
    Definition Classes
    HDFSMetadataLog
  46. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  47. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  48. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  49. def offsetSeqMetadataForBatchId(batchId: Long): Option[OffsetSeqMetadata]
  50. def pathToBatchId(path: Path): Long
    Attributes
    protected
    Definition Classes
    HDFSMetadataLog
  51. def purge(thresholdBatchId: Long): Unit

    Removes all the log entry earlier than thresholdBatchId (exclusive).

    Removes all the log entry earlier than thresholdBatchId (exclusive).

    Definition Classes
    HDFSMetadataLogMetadataLog
  52. def purgeAfter(thresholdBatchId: Long): Unit

    Removes all log entries later than thresholdBatchId (exclusive).

    Removes all log entries later than thresholdBatchId (exclusive).

    Definition Classes
    HDFSMetadataLog
  53. def serialize(offsetSeq: OffsetSeq, out: OutputStream): Unit

    Serialize the metadata and write to the output stream.

    Serialize the metadata and write to the output stream. If this method is overridden in a subclass, the overriding method should not close the given output stream, as it will be closed in the caller.

    Attributes
    protected
    Definition Classes
    OffsetSeqLogHDFSMetadataLog
  54. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  55. def toString(): String
    Definition Classes
    AnyRef → Any
  56. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  57. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  58. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  59. def write(batchMetadataFile: Path, fn: (OutputStream) ⇒ Unit): Unit
    Attributes
    protected
    Definition Classes
    HDFSMetadataLog

Inherited from HDFSMetadataLog[OffsetSeq]

Inherited from Logging

Inherited from MetadataLog[OffsetSeq]

Inherited from AnyRef

Inherited from Any

Ungrouped