public class TransactionDBOptions extends RocksObject
nativeHandle_owningHandle_| 构造器和说明 |
|---|
TransactionDBOptions() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
disposeInternal(long handle) |
long |
getDefaultLockTimeout()
The wait timeout in milliseconds when writing a key
OUTSIDE of a transaction (ie by calling
RocksDB.put(byte[], byte[]),
RocksDB.merge(byte[], byte[]), RocksDB.delete(byte[]) or RocksDB.write(org.rocksdb.WriteOptions, org.rocksdb.WriteBatch)
directly). |
long |
getMaxNumLocks()
Specifies the maximum number of keys that can be locked at the same time
per column family.
|
long |
getNumStripes()
The number of sub-tables per lock table (per column family)
|
long |
getTransactionLockTimeout()
The default wait timeout in milliseconds when
a transaction attempts to lock a key if not specified by
TransactionOptions.setLockTimeout(long)
If 0, no waiting is done if a lock cannot instantly be acquired. |
TxnDBWritePolicy |
getWritePolicy()
The policy for when to write the data into the DB.
|
TransactionDBOptions |
setDefaultLockTimeout(long defaultLockTimeout)
If positive, specifies the wait timeout in milliseconds when writing a key
OUTSIDE of a transaction (ie by calling
RocksDB.put(byte[], byte[]),
RocksDB.merge(byte[], byte[]), RocksDB.delete(byte[]) or RocksDB.write(org.rocksdb.WriteOptions, org.rocksdb.WriteBatch)
directly). |
TransactionDBOptions |
setMaxNumLocks(long maxNumLocks)
Specifies the maximum number of keys that can be locked at the same time
per column family.
|
TransactionDBOptions |
setNumStripes(long numStripes)
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.
|
TransactionDBOptions |
setTransactionLockTimeout(long transactionLockTimeout)
If positive, specifies the default wait timeout in milliseconds when
a transaction attempts to lock a key if not specified by
TransactionOptions.setLockTimeout(long)
If 0, no waiting is done if a lock cannot instantly be acquired. |
TransactionDBOptions |
setWritePolicy(TxnDBWritePolicy writePolicy)
The policy for when to write the data into the DB.
|
disposeInternal, getNativeHandleclose, disOwnNativeHandle, isOwningHandlepublic long getMaxNumLocks()
If the number of locked keys is greater than #getMaxNumLocks(),
transaction writes (or GetForUpdate) will return an error.
public TransactionDBOptions setMaxNumLocks(long maxNumLocks)
If the number of locked keys is greater than getMaxNumLocks(),
transaction writes (or GetForUpdate) will return an error.
maxNumLocks - The maximum number of keys that can be locked;
If this value is not positive, no limit will be enforced.public long getNumStripes()
public TransactionDBOptions setNumStripes(long numStripes)
Default: 16
numStripes - The number of sub-tablespublic long getTransactionLockTimeout()
TransactionOptions.setLockTimeout(long)
If 0, no waiting is done if a lock cannot instantly be acquired.
If negative, there is no timeout.public TransactionDBOptions setTransactionLockTimeout(long transactionLockTimeout)
TransactionOptions.setLockTimeout(long)
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
transactionLockTimeout - the default wait timeout in millisecondspublic long getDefaultLockTimeout()
RocksDB.put(byte[], byte[]),
RocksDB.merge(byte[], byte[]), RocksDB.delete(byte[]) or RocksDB.write(org.rocksdb.WriteOptions, org.rocksdb.WriteBatch)
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.
public TransactionDBOptions setDefaultLockTimeout(long defaultLockTimeout)
RocksDB.put(byte[], byte[]),
RocksDB.merge(byte[], byte[]), RocksDB.delete(byte[]) or RocksDB.write(org.rocksdb.WriteOptions, org.rocksdb.WriteBatch)
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
defaultLockTimeout - the timeout in milliseconds when writing a key
OUTSIDE of a transactionpublic TxnDBWritePolicy getWritePolicy()
TxnDBWritePolicy.WRITE_COMMITTED.
The data could be written before the commit phase. The DB then needs to
provide the mechanisms to tell apart committed from uncommitted data.public TransactionDBOptions setWritePolicy(TxnDBWritePolicy writePolicy)
TxnDBWritePolicy.WRITE_COMMITTED.
The data could be written before the commit phase. The DB then needs to
provide the mechanisms to tell apart committed from uncommitted data.writePolicy - The write policy.protected final void disposeInternal(long handle)
disposeInternal 在类中 RocksObject