Opening a TransactionDB
Open
const Options&
Database options including block cache, compression, etc.
const TransactionDBOptions&
Transaction-specific options including lock timeout, write policy, and deadlock detection.
const std::string&
Path to the database directory.
TransactionDB**
Output parameter for the opened TransactionDB instance.
Status
Returns OK on success, or an error status if the database cannot be opened.
Transaction Management
BeginTransaction
const WriteOptions&
Write options for the transaction.
const TransactionOptions&
Transaction-specific options including snapshot settings, lock timeout, and deadlock detection.
Transaction*
Optional transaction handle to reuse instead of allocating a new one.
Transaction*
Returns a pointer to the new transaction. Caller is responsible for deletion.
GetTransactionByName
GetAllPreparedTransactions
Lock Management
GetLockStatusData
GetDeadlockInfoBuffer
SetDeadlockInfoBufferSize
Snapshot Management
CreateTimestampedSnapshot
GetTimestampedSnapshot
ReleaseTimestampedSnapshotsOlderThan
Options and Configuration
TransactionDBOptions
int64_t
Maximum number of keys that can be locked per column family. -1 means no limit.
int64_t
Default wait timeout in milliseconds when a transaction attempts to lock a key.
TxnDBWritePolicy
When to write data: WRITE_COMMITTED (default), WRITE_PREPARED, or WRITE_UNPREPARED.
TransactionOptions
bool
Whether to automatically set a snapshot at transaction start.
bool
Whether to check for deadlocks before acquiring locks.