class RocksDB extends Logging
Class representing a RocksDB instance that checkpoints version of data to DFS.
After a set of updates, a new version can be committed by calling commit().
Any past version can be loaded by calling load(version).
- Note
This class is not thread-safe, so use it only from one thread.
- See also
RocksDBFileManager to see how the files are laid out in local disk and DFS.
- Alphabetic
- By Inheritance
- RocksDB
- Logging
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new RocksDB(dfsRootDir: String, conf: RocksDBConf, localRootDir: File = Utils.createTempDir(), hadoopConf: Configuration = new Configuration, loggingId: String = "", useColumnFamilies: Boolean = false, enableStateStoreCheckpointIds: Boolean = false, partitionId: Int = 0)
- conf
Configuration for RocksDB
- localRootDir
Root directory in local disk that is used to working and checkpointing dirs
- hadoopConf
Hadoop configuration for talking to the remote file system
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
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def checkColFamilyExists(colFamilyName: String): Boolean
Function to check if the column family exists in the state store instance.
Function to check if the column family exists in the state store instance.
- colFamilyName
- name of the column family
- returns
- true if the column family exists, false otherwise
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- def close(): Unit
Release all resources
- def commit(): (Long, StateStoreCheckpointInfo)
Commit all the updates made as a version to DFS.
Commit all the updates made as a version to DFS. The steps it needs to do to commits are: - Flush all changes to disk - Create a RocksDB checkpoint in a new local dir - Sync the checkpoint dir files to DFS
- val conf: RocksDBConf
- def createColFamilyIfAbsent(colFamilyName: String, isInternal: Boolean): Short
Check if the column family exists with given name and create one if it doesn't.
Check if the column family exists with given name and create one if it doesn't. Users can create external column families storing user facing data as well as internal column families such as secondary indexes. Metrics for both of these types are tracked separately.
- colFamilyName
- column family name
- isInternal
- whether the column family is for internal use or not
- returns
- virtual column family id
- def doMaintenance(): Unit
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def get(key: Array[Byte], cfName: String = StateStore.DEFAULT_COL_FAMILY_NAME): Array[Byte]
Get the value for the given key if present, or null.
Get the value for the given key if present, or null.
- Note
This will return the last written value even if it was uncommitted.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def getColFamilyCount(isInternal: Boolean): Long
- def getLatestVersion(): Long
Get the latest version available in the DFS
- def getWriteBufferManagerAndCache(): (WriteBufferManager, Cache)
Get the write buffer manager and cache
- 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 isTraceEnabled(): Boolean
- Attributes
- protected
- Definition Classes
- Logging
- def iterator(cfName: String): NextIterator[ByteArrayPair]
Get an iterator of all committed and uncommitted key-value pairs for the given column family.
- def iterator(): NextIterator[ByteArrayPair]
Get an iterator of all committed and uncommitted key-value pairs.
- var lastCommitBasedStateStoreCkptId: Option[String]
- Attributes
- protected
- var lastCommittedStateStoreCkptId: Option[String]
- Attributes
- protected
- val lineageManager: RocksDBLineageManager
- Attributes
- protected[sql]
- def load(version: Long, stateStoreCkptId: Option[String] = None, readOnly: Boolean = false): RocksDB
- def loadFromSnapshot(snapshotVersion: Long, endVersion: Long): RocksDB
Load from the start snapshot version and apply all the changelog records to reach the end version.
Load from the start snapshot version and apply all the changelog records to reach the end version. Note that this will copy all the necessary files from DFS to local disk as needed, and possibly restart the native RocksDB instance.
- snapshotVersion
version of the snapshot to start with
- endVersion
end version
- returns
A RocksDB instance loaded with the state endVersion replayed from snapshotVersion. Note that the instance will be read-only since this method is only used in State Data Source.
- var loadedStateStoreCkptId: Option[String]
- Attributes
- protected
- var loadedVersion: Long
- Attributes
- protected
- def log: Logger
- 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
- RocksDB → 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 merge(key: Array[Byte], value: Array[Byte], cfName: String = StateStore.DEFAULT_COL_FAMILY_NAME, includesPrefix: Boolean = false): Unit
Merge the given value for the given key.
Merge the given value for the given key. This is equivalent to the Atomic Read-Modify-Write operation in RocksDB, known as the "Merge" operation. The modification is appending the provided value to current list of values for the given key.
- Note
This operation requires that the encoder used can decode multiple values for a key from the values byte array.
,This update is not committed to disk until commit() is called.
- def metricsOpt: Option[RocksDBMetrics]
Function to return RocksDB metrics if the recorded metrics are available and the operator has reached the commit stage for this state store instance and version.
Function to return RocksDB metrics if the recorded metrics are available and the operator has reached the commit stage for this state store instance and version. If not, we return None
- returns
- Return RocksDBMetrics if available and None otherwise
- 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()
- def prefixScan(prefix: Array[Byte], cfName: String = StateStore.DEFAULT_COL_FAMILY_NAME): NextIterator[ByteArrayPair]
- def put(key: Array[Byte], value: Array[Byte], cfName: String = StateStore.DEFAULT_COL_FAMILY_NAME, includesPrefix: Boolean = false): Unit
Put the given value for the given key.
Put the given value for the given key.
- Note
This update is not committed to disk until commit() is called.
- def remove(key: Array[Byte], cfName: String = StateStore.DEFAULT_COL_FAMILY_NAME, includesPrefix: Boolean = false): Unit
Remove the key if present.
Remove the key if present.
- Note
This update is not committed to disk until commit() is called.
- def removeColFamilyIfExists(colFamilyName: String): Boolean
Remove RocksDB column family, if exists
Remove RocksDB column family, if exists
- returns
columnFamilyId if it exists, else None
- def rollback(): Unit
Drop uncommitted changes, and roll back to previous version.
- var sessionStateStoreCkptId: Option[String]
- Attributes
- protected
- 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)