pub struct TransactionDBOptions { /* private fields */ }Implementations§
Source§impl TransactionDBOptions
impl TransactionDBOptions
pub fn new() -> TransactionDBOptions
Sourcepub fn set_default_lock_timeout(&mut self, default_lock_timeout: i64)
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).
Sourcepub fn set_txn_lock_timeout(&mut self, txn_lock_timeout: i64)
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).
Sourcepub fn set_max_num_locks(&mut self, max_num_locks: i64)
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.
Sourcepub fn set_num_stripes(&mut self, num_stripes: usize)
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.
Sourcepub fn set_enable_udt_validation(&mut self, val: bool)
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.
Sourcepub fn get_enable_udt_validation(&self) -> bool
pub fn get_enable_udt_validation(&self) -> bool
Returns the value of the enable_udt_validation option.
Sourcepub fn set_max_num_deadlocks(&mut self, val: u32)
pub fn set_max_num_deadlocks(&mut self, val: u32)
Stores the number of latest deadlocks to track
Sourcepub fn get_max_num_deadlocks(&self) -> u32
pub fn get_max_num_deadlocks(&self) -> u32
Returns the value of the max_num_deadlocks option.
Sourcepub fn get_num_stripes(&self) -> usize
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.
Sourcepub fn set_rollback_merge_operands(&mut self, val: bool)
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.
Sourcepub fn get_rollback_merge_operands(&self) -> bool
pub fn get_rollback_merge_operands(&self) -> bool
Returns the value of the rollback_merge_operands option.
Sourcepub fn set_skip_concurrency_control(&mut self, val: bool)
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.
Sourcepub fn get_skip_concurrency_control(&self) -> bool
pub fn get_skip_concurrency_control(&self) -> bool
Returns the value of the skip_concurrency_control option.
Sourcepub fn set_txn_commit_bypass_memtable_threshold(&mut self, val: u32)
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.
Sourcepub fn get_txn_commit_bypass_memtable_threshold(&self) -> u32
pub fn get_txn_commit_bypass_memtable_threshold(&self) -> u32
Returns the value of the txn_commit_bypass_memtable_threshold option.
Sourcepub fn set_use_per_key_point_lock_mgr(&mut self, val: bool)
pub fn set_use_per_key_point_lock_mgr(&mut self, val: bool)
EXPERIMENTAL
Flag to enable/disable the per key point lock manager.
Sourcepub fn get_use_per_key_point_lock_mgr(&self) -> bool
pub fn get_use_per_key_point_lock_mgr(&self) -> bool
Returns the value of the use_per_key_point_lock_mgr option.
Sourcepub fn get_default_lock_timeout(&self) -> i64
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.
Sourcepub fn get_default_write_batch_flush_threshold(&self) -> i64
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.
Sourcepub fn get_max_num_locks(&self) -> i64
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.
Sourcepub fn get_transaction_lock_timeout(&self) -> i64
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.
Sourcepub fn set_default_write_batch_flush_threshold(&mut self, val: i64)
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.
Sourcepub fn set_write_policy(&mut self, policy: TxnDBWritePolicy)
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.
Sourcepub fn get_write_policy(&self) -> Option<TxnDBWritePolicy>
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.