Package org.rocksdb

Class TransactionOptions

All Implemented Interfaces:
AutoCloseable

public class TransactionOptions extends RocksObject
  • Constructor Details

    • TransactionOptions

      public TransactionOptions()
  • Method Details

    • isSetSnapshot

      public boolean isSetSnapshot()
    • setSetSnapshot

      public TransactionOptions setSetSnapshot(boolean setSnapshot)
    • isDeadlockDetect

      public boolean isDeadlockDetect()
      True means that before acquiring locks, this transaction will check if doing so will cause a deadlock. If so, it will return with Status.Code.Busy. The user should retry their transaction.
      Returns:
      true if a deadlock is detected.
    • setDeadlockDetect

      public TransactionOptions setDeadlockDetect(boolean deadlockDetect)
      Setting to true means that before acquiring locks, this transaction will check if doing so will cause a deadlock. If so, it will return with Status.Code.Busy. The user should retry their transaction.
      Parameters:
      deadlockDetect - true if we should detect deadlocks.
      Returns:
      this TransactionOptions instance
    • getLockTimeout

      public long getLockTimeout()
      The wait timeout in milliseconds when a transaction attempts to lock a key.

      If 0, no waiting is done if a lock cannot instantly be acquired. If negative, TransactionDBOptions.getTransactionLockTimeout(long) will be used

      Returns:
      the lock timeout in milliseconds
    • setLockTimeout

      public TransactionOptions setLockTimeout(long lockTimeout)
      If positive, specifies the wait timeout in milliseconds when a transaction attempts to lock a key.

      If 0, no waiting is done if a lock cannot instantly be acquired. If negative, TransactionDBOptions.getTransactionLockTimeout(long) will be used

      Default: -1

      Parameters:
      lockTimeout - the lock timeout in milliseconds
      Returns:
      this TransactionOptions instance
    • getExpiration

      public long getExpiration()
      Expiration duration in milliseconds.

      If non-negative, transactions that last longer than this many milliseconds will fail to commit. If not set, a forgotten transaction that is never committed, rolled back, or deleted will never relinquish any locks it holds. This could prevent keys from being written by other writers.

      Returns:
      expiration the expiration duration in milliseconds
    • setExpiration

      public TransactionOptions setExpiration(long expiration)
      Expiration duration in milliseconds.

      If non-negative, transactions that last longer than this many milliseconds will fail to commit. If not set, a forgotten transaction that is never committed, rolled back, or deleted will never relinquish any locks it holds. This could prevent keys from being written by other writers.

      Default: -1

      Parameters:
      expiration - the expiration duration in milliseconds
      Returns:
      this TransactionOptions instance
    • getDeadlockDetectDepth

      public long getDeadlockDetectDepth()
      Gets the number of traversals to make during deadlock detection.
      Returns:
      the number of traversals to make during deadlock detection
    • setDeadlockDetectDepth

      public TransactionOptions setDeadlockDetectDepth(long deadlockDetectDepth)
      Sets the number of traversals to make during deadlock detection.

      Default: 50

      Parameters:
      deadlockDetectDepth - the number of traversals to make during deadlock detection
      Returns:
      this TransactionOptions instance
    • getMaxWriteBatchSize

      public long getMaxWriteBatchSize()
      Get the maximum number of bytes that may be used for the write batch.
      Returns:
      the maximum number of bytes, 0 means no limit.
    • setMaxWriteBatchSize

      public TransactionOptions setMaxWriteBatchSize(long maxWriteBatchSize)
      Set the maximum number of bytes that may be used for the write batch.
      Parameters:
      maxWriteBatchSize - the maximum number of bytes, 0 means no limit.
      Returns:
      this TransactionOptions instance
    • disposeInternal

      protected final void disposeInternal(long handle)
      Specified by:
      disposeInternal in class RocksObject