Skip to main content

TransactionDBOptions

Struct TransactionDBOptions 

Source
pub struct TransactionDBOptions { /* private fields */ }

Implementations§

Source§

impl TransactionDBOptions

Source

pub fn new() -> TransactionDBOptions

Source

pub fn set_default_lock_timeout(&mut self, default_lock_timeout: i64)

Specifies the wait timeout in milliseconds when writing a key outside a transaction (i.e. by calling TransactionDB::put directly).

If 0, no waiting is done if a lock cannot instantly be acquired. If negative, there is no timeout and will block indefinitely when acquiring a lock.

Not using a timeout can lead to deadlocks. Currently, there is no deadlock-detection to recover from a deadlock. While DB writes cannot deadlock with other DB writes, they can deadlock with a transaction. A negative timeout should only be used if all transactions have a small expiration set.

Default: 1000(1s).

Source

pub fn set_txn_lock_timeout(&mut self, txn_lock_timeout: i64)

Specifies the default wait timeout in milliseconds when a transaction attempts to lock a key if not specified in TransactionOptions.

If 0, no waiting is done if a lock cannot instantly be acquired. If negative, there is no timeout. Not using a timeout is not recommended as it can lead to deadlocks. Currently, there is no deadlock-detection to recover from a deadlock.

Default: 1000(1s).

Source

pub fn set_max_num_locks(&mut self, max_num_locks: i64)

Specifies the maximum number of keys that can be locked at the same time per column family.

If the number of locked keys is greater than max_num_locks, transaction writes (or get_for_update) will return an error. If this value is not positive, no limit will be enforced.

Default: -1.

Source

pub fn set_num_stripes(&mut self, num_stripes: usize)

Specifies lock table stripes count.

Increasing this value will increase the concurrency by dividing the lock table (per column family) into more sub-tables, each with their own separate mutex.

Default: 16.

Source

pub fn set_enable_udt_validation(&mut self, val: bool)

A flag to control for the whole DB whether user-defined timestamp based validation are enabled when applicable. Only WriteCommittedTxn support user-defined timestamps so this option only applies in this case.

Source

pub fn get_enable_udt_validation(&self) -> bool

Returns the value of the enable_udt_validation option.

Source

pub fn set_max_num_deadlocks(&mut self, val: u32)

Stores the number of latest deadlocks to track

Source

pub fn get_max_num_deadlocks(&self) -> u32

Returns the value of the max_num_deadlocks option.

Source

pub fn get_num_stripes(&self) -> usize

Increasing this value will increase the concurrency by dividing the lock table (per column family) into more sub-tables, each with their own separate mutex.

Source

pub fn set_rollback_merge_operands(&mut self, val: bool)

TODO(myabandeh): remove this option Note: this is a temporary option as a hot fix in rollback of writeprepared txns in myrocks. MyRocks uses merge operands for autoinc column id without however obtaining locks. This breaks the assumption behind the rollback logic in myrocks. This hack of simply not rolling back merge operands works for the special way that myrocks uses this operands.

Source

pub fn get_rollback_merge_operands(&self) -> bool

Returns the value of the rollback_merge_operands option.

Source

pub fn set_skip_concurrency_control(&mut self, val: bool)

If true, the TransactionDB implementation might skip concurrency control unless it is overridden by TransactionOptions or TransactionDBWriteOptimizations. This can be used in conjunction with DBOptions::unordered_write when the TransactionDB is used solely for write ordering rather than concurrency control.

Source

pub fn get_skip_concurrency_control(&self) -> bool

Returns the value of the skip_concurrency_control option.

Source

pub fn set_txn_commit_bypass_memtable_threshold(&mut self, val: u32)

Deprecated, this option has no effect and may be removed in the future. Use TransactionOptions::large_txn_commit_optimize_threshold instead.

This option is only valid for write committed. If the number of updates in a transaction is at least this threshold, then the transaction commit will skip insertions into memtable as an optimization to reduce commit latency. See comment for TransactionOptions::commit_bypass_memtable for more detail. Setting TransactionOptions::commit_bypass_memtable to true takes precedence over this option.

Source

pub fn get_txn_commit_bypass_memtable_threshold(&self) -> u32

Returns the value of the txn_commit_bypass_memtable_threshold option.

Source

pub fn set_use_per_key_point_lock_mgr(&mut self, val: bool)

EXPERIMENTAL

Flag to enable/disable the per key point lock manager.

Source

pub fn get_use_per_key_point_lock_mgr(&self) -> bool

Returns the value of the use_per_key_point_lock_mgr option.

Source

pub fn get_default_lock_timeout(&self) -> i64

Returns the current default_lock_timeout setting.

See Self::set_default_lock_timeout for what this controls.

Source

pub fn get_default_write_batch_flush_threshold(&self) -> i64

Returns the current default_write_batch_flush_threshold setting.

See Self::set_default_write_batch_flush_threshold for what this controls.

Source

pub fn get_max_num_locks(&self) -> i64

Returns the current max_num_locks setting.

See Self::set_max_num_locks for what this controls.

Source

pub fn get_transaction_lock_timeout(&self) -> i64

If positive, specifies the default wait timeout in milliseconds when a transaction attempts to lock a key if not specified by TransactionOptions::lock_timeout.

If 0, no waiting is done if a lock cannot instantly be acquired. If negative, there is no timeout. Not using a timeout is not recommended as it can lead to deadlocks. Currently, there is no deadlock-detection to recover from a deadlock.

Source

pub fn set_default_write_batch_flush_threshold(&mut self, val: i64)

This option is only valid for write unprepared. If a write batch exceeds this threshold, then the transaction will implicitly flush the currently pending writes into the database. A value of 0 or less means no limit.

Source

pub fn set_write_policy(&mut self, policy: TxnDBWritePolicy)

Sets when transaction data becomes visible in the DB.

Only read while opening a TransactionDB, so this has to be set before the open call. See TxnDBWritePolicy for what each policy costs.

Default: TxnDBWritePolicy::WriteCommitted.

Source

pub fn get_write_policy(&self) -> Option<TxnDBWritePolicy>

The write policy set by Self::set_write_policy.

TxnDBWritePolicy covers every policy RocksDB defines today, so None only shows up if a future release adds one.

Trait Implementations§

Source§

impl Default for TransactionDBOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Drop for TransactionDBOptions

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Send for TransactionDBOptions

Source§

impl Sync for TransactionDBOptions

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.