class RocksDBStateMachine extends Logging
A state machine that manages the lifecycle of a RocksDB instance
This class enforces proper state transitions and ensures thread-safety for accessing RocksDB instances. It prevents concurrent modifications to the same native RocksDB instance by using a stamp-based locking mechanism.
State Lifecycle: - RELEASED: The RocksDB instance is not being accessed by any thread - ACQUIRED: The RocksDB instance is currently being accessed by a thread - CLOSED: The RocksDB instance has been closed and can no longer be used
Valid Transitions: - RELEASED -> ACQUIRED: When a thread acquires the RocksDB instance - ACQUIRED -> RELEASED: When a thread releases the RocksDB instance - RELEASED -> CLOSED: When the RocksDB instance is shut down - ACQUIRED -> MAINTENANCE: Maintenance can be performed on an acquired RocksDB instance - RELEASED -> MAINTENANCE: Maintenance can be performed on a released RocksDB instance
Stamps: Each time a RocksDB instance is acquired, a unique stamp is generated. This stamp must be presented when performing operations on the RocksDB instance and when releasing it. This ensures that only the stamp owner that acquired the RocksDB instance can release it or perform operations.
- Alphabetic
- By Inheritance
- RocksDBStateMachine
- Logging
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new RocksDBStateMachine(stateStoreId: StateStoreId, rocksDBConf: RocksDBConf)
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
- def acquireStamp(): Long
Acquires the RocksDB instance for exclusive use by the calling task.
Acquires the RocksDB instance for exclusive use by the calling task. Transitions the state from RELEASED to ACQUIRED.
This method will block if another task currently has a stamp for the RocksDB instance, waiting up to the configured timeout before throwing an exception.
- returns
A unique stamp that must be used for subsequent operations and release
- Exceptions thrown
QueryExecutionErrors.unreleasedThreadErrorif timeout occurs waiting for another threadStateStoreInvalidStateMachineTransitionif the RocksDB instance is in CLOSED state
- 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(): Boolean
Closes the RocksDB instance permanently, transitioning it to CLOSED state.
Closes the RocksDB instance permanently, transitioning it to CLOSED state. Once closed, the RocksDB instance cannot be used again and all future operations will fail.
This method will block if another task currently has a stamp for the RocksDB instance, waiting up to the configured timeout before throwing an exception.
- Exceptions thrown
QueryExecutionErrors.unreleasedThreadErrorif timeout occurs waiting for another threadStateStoreInvalidStateMachineTransitionif called multiple times (idempotent)
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- 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 isTraceEnabled(): Boolean
- Attributes
- protected
- Definition Classes
- Logging
- 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
- 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 releaseStamp(stamp: Long, throwEx: Boolean = true): Boolean
Releases the RocksDB instance, transitioning it from ACQUIRED to RELEASED state.
Releases the RocksDB instance, transitioning it from ACQUIRED to RELEASED state. This can only be called by the stamp owner that acquired the RocksDB instance.
- stamp
The stamp that was returned when the RocksDB instance was acquired
- throwEx
Whether to throw an exception if the stamp is invalid (default: true)
- returns
true if the RocksDB instance was successfully released, false if stamp was invalid and throwEx=false
- Exceptions thrown
StateStoreInvalidStampif stamp is invalid and throwEx=trueStateStoreInvalidStateMachineTransitionif the current state doesn't allow release
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def verifyForMaintenance(): Unit
This verifies that it is in a state that allows maintenance to be performed.
This verifies that it is in a state that allows maintenance to be performed. This operation is allowed in both RELEASED and ACQUIRED states.
- Exceptions thrown
StateStoreInvalidStateMachineTransitionif the RocksDB instance is in CLOSED state
- def verifyStamp(stamp: Long): Unit
Verifies that the provided stamp matches the current valid stamp.
Verifies that the provided stamp matches the current valid stamp. This ensures that operations are performed by the task that acquired the RocksDB instance.
- stamp
The stamp to verify against the current valid stamp
- Exceptions thrown
StateStoreInvalidStampif the stamp does not match the current valid stamp
- 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)