* @param key the key to retrieve the value for.
* @param exclusive true if the transaction should have exclusive access to
* the key, otherwise false for shared access.
- * @param do_validate true if it should validate the snapshot before doing the read
+ * @param doValidate true if it should validate the snapshot before doing the read
*
* @return a byte array storing the value associated with the input key if
* any. null if it does not find the specified key.
*/
public byte[] getForUpdate(final ReadOptions readOptions,
final ColumnFamilyHandle columnFamilyHandle, final byte[] key, final boolean exclusive,
- final boolean do_validate) throws RocksDBException {
+ final boolean doValidate) throws RocksDBException {
assert (isOwningHandle());
return getForUpdate(nativeHandle_, readOptions.nativeHandle_, key, key.length,
- columnFamilyHandle.nativeHandle_, exclusive, do_validate);
+ columnFamilyHandle.nativeHandle_, exclusive, doValidate);
}
/**
* Same as
* {@link #getForUpdate(ReadOptions, ColumnFamilyHandle, byte[], boolean, boolean)}
- * with do_validate=true.
+ * with doValidate=true.
*
* @param readOptions Read options.
* @param columnFamilyHandle {@link org.rocksdb.ColumnFamilyHandle}
final boolean exclusive) throws RocksDBException {
assert(isOwningHandle());
return getForUpdate(nativeHandle_, readOptions.nativeHandle_, key, key.length,
- columnFamilyHandle.nativeHandle_, exclusive, true /*do_validate*/);
+ columnFamilyHandle.nativeHandle_, exclusive, true /*doValidate*/);
}
/**
final boolean exclusive) throws RocksDBException {
assert(isOwningHandle());
return getForUpdate(
- nativeHandle_, readOptions.nativeHandle_, key, key.length, exclusive, true /*do_validate*/);
+ nativeHandle_, readOptions.nativeHandle_, key, key.length, exclusive, true /*doValidate*/);
}
/**
* @param columnFamilyHandle The column family to put the key/value into
* @param key the specified key to be inserted.
* @param value the value associated with the specified key.
+ * @param assumeTracked true when it is expected that the key is already
+ * tracked. More specifically, it means the the key was previous tracked
+ * in the same savepoint, with the same exclusive flag, and at a lower
+ * sequence number. If valid then it skips ValidateSnapshot,
+ * throws an error otherwise.
*
* @throws RocksDBException when one of the TransactionalDB conditions
* described above occurs, or in the case of an unexpected error
*/
- public void put(final ColumnFamilyHandle columnFamilyHandle, final byte[] key, final byte[] value,
- final boolean assume_tracked) throws RocksDBException {
+ public void put(final ColumnFamilyHandle columnFamilyHandle, final byte[] key,
+ final byte[] value, final boolean assumeTracked) throws RocksDBException {
assert (isOwningHandle());
- put(nativeHandle_, key, key.length, value, value.length, columnFamilyHandle.nativeHandle_,
- assume_tracked);
+ put(nativeHandle_, key, key.length, value, value.length,
+ columnFamilyHandle.nativeHandle_, assumeTracked);
}
- /*
- * Same as
- * {@link #put(ColumnFamilyHandle, byte[], byte[], boolean)}
- * with assume_tracked=false.
+ /**
+ * Similar to {@link #put(ColumnFamilyHandle, byte[], byte[], boolean)}
+ * but with {@code assumeTracked = false}.
+ *
+ * Will also perform conflict checking on the keys be written.
+ *
+ * If this Transaction was created on an {@link OptimisticTransactionDB},
+ * these functions should always succeed.
+ *
+ * If this Transaction was created on a {@link TransactionDB}, an
+ * {@link RocksDBException} may be thrown with an accompanying {@link Status}
+ * when:
+ * {@link Status.Code#Busy} if there is a write conflict,
+ * {@link Status.Code#TimedOut} if a lock could not be acquired,
+ * {@link Status.Code#TryAgain} if the memtable history size is not large
+ * enough. See
+ * {@link ColumnFamilyOptions#maxWriteBufferNumberToMaintain()}
+ *
+ * @param columnFamilyHandle The column family to put the key/value into
+ * @param key the specified key to be inserted.
+ * @param value the value associated with the specified key.
+ *
+ * @throws RocksDBException when one of the TransactionalDB conditions
+ * described above occurs, or in the case of an unexpected error
*/
public void put(final ColumnFamilyHandle columnFamilyHandle, final byte[] key,
final byte[] value) throws RocksDBException {
assert(isOwningHandle());
- put(nativeHandle_, key, key.length, value, value.length, columnFamilyHandle.nativeHandle_,
- /*assume_tracked*/ false);
+ put(nativeHandle_, key, key.length, value, value.length,
+ columnFamilyHandle.nativeHandle_, false);
}
/**
* @param columnFamilyHandle The column family to put the key/value into
* @param keyParts the specified key to be inserted.
* @param valueParts the value associated with the specified key.
+ * @param assumeTracked true when it is expected that the key is already
+ * tracked. More specifically, it means the the key was previous tracked
+ * in the same savepoint, with the same exclusive flag, and at a lower
+ * sequence number. If valid then it skips ValidateSnapshot,
+ * throws an error otherwise.
*
* @throws RocksDBException when one of the TransactionalDB conditions
* described above occurs, or in the case of an unexpected error
*/
- public void put(final ColumnFamilyHandle columnFamilyHandle, final byte[][] keyParts,
- final byte[][] valueParts, final boolean assume_tracked) throws RocksDBException {
+ public void put(final ColumnFamilyHandle columnFamilyHandle,
+ final byte[][] keyParts, final byte[][] valueParts,
+ final boolean assumeTracked) throws RocksDBException {
assert (isOwningHandle());
put(nativeHandle_, keyParts, keyParts.length, valueParts, valueParts.length,
- columnFamilyHandle.nativeHandle_, assume_tracked);
+ columnFamilyHandle.nativeHandle_, assumeTracked);
}
- /*
- * Same as
- * {@link #put(ColumnFamilyHandle, byte[][], byte[][], boolean)}
- * with assume_tracked=false.
+ /**
+ * Similar to {@link #put(ColumnFamilyHandle, byte[][], byte[][], boolean)}
+ * but with with {@code assumeTracked = false}.
+ *
+ * Allows you to specify the key and value in several parts that will be
+ * concatenated together.
+ *
+ * @param columnFamilyHandle The column family to put the key/value into
+ * @param keyParts the specified key to be inserted.
+ * @param valueParts the value associated with the specified key.
+ *
+ * @throws RocksDBException when one of the TransactionalDB conditions
+ * described above occurs, or in the case of an unexpected error
*/
public void put(final ColumnFamilyHandle columnFamilyHandle,
final byte[][] keyParts, final byte[][] valueParts)
throws RocksDBException {
assert(isOwningHandle());
put(nativeHandle_, keyParts, keyParts.length, valueParts, valueParts.length,
- columnFamilyHandle.nativeHandle_, /*assume_tracked*/ false);
+ columnFamilyHandle.nativeHandle_, false);
}
//TODO(AR) refactor if we implement org.rocksdb.SliceParts in future
* @param columnFamilyHandle The column family to merge the key/value into
* @param key the specified key to be merged.
* @param value the value associated with the specified key.
+ * @param assumeTracked true when it is expected that the key is already
+ * tracked. More specifically, it means the the key was previous tracked
+ * in the same savepoint, with the same exclusive flag, and at a lower
+ * sequence number. If valid then it skips ValidateSnapshot,
+ * throws an error otherwise.
*
* @throws RocksDBException when one of the TransactionalDB conditions
* described above occurs, or in the case of an unexpected error
*/
- public void merge(final ColumnFamilyHandle columnFamilyHandle, final byte[] key,
- final byte[] value, final boolean assume_tracked) throws RocksDBException {
+ public void merge(final ColumnFamilyHandle columnFamilyHandle,
+ final byte[] key, final byte[] value, final boolean assumeTracked)
+ throws RocksDBException {
assert (isOwningHandle());
- merge(nativeHandle_, key, key.length, value, value.length, columnFamilyHandle.nativeHandle_,
- assume_tracked);
+ merge(nativeHandle_, key, key.length, value, value.length,
+ columnFamilyHandle.nativeHandle_, assumeTracked);
}
- /*
- * Same as
- * {@link #merge(ColumnFamilyHandle, byte[], byte[], boolean)}
- * with assume_tracked=false.
+ /**
+ * Similar to {@link #merge(ColumnFamilyHandle, byte[], byte[], boolean)}
+ * but with {@code assumeTracked = false}.
+ *
+ * Will also perform conflict checking on the keys be written.
+ *
+ * If this Transaction was created on an {@link OptimisticTransactionDB},
+ * these functions should always succeed.
+ *
+ * If this Transaction was created on a {@link TransactionDB}, an
+ * {@link RocksDBException} may be thrown with an accompanying {@link Status}
+ * when:
+ * {@link Status.Code#Busy} if there is a write conflict,
+ * {@link Status.Code#TimedOut} if a lock could not be acquired,
+ * {@link Status.Code#TryAgain} if the memtable history size is not large
+ * enough. See
+ * {@link ColumnFamilyOptions#maxWriteBufferNumberToMaintain()}
+ *
+ * @param columnFamilyHandle The column family to merge the key/value into
+ * @param key the specified key to be merged.
+ * @param value the value associated with the specified key.
+ *
+ * @throws RocksDBException when one of the TransactionalDB conditions
+ * described above occurs, or in the case of an unexpected error
*/
public void merge(final ColumnFamilyHandle columnFamilyHandle,
final byte[] key, final byte[] value) throws RocksDBException {
assert(isOwningHandle());
- merge(nativeHandle_, key, key.length, value, value.length, columnFamilyHandle.nativeHandle_,
- /*assume_tracked*/ false);
+ merge(nativeHandle_, key, key.length, value, value.length,
+ columnFamilyHandle.nativeHandle_, false);
}
/**
*
* @param columnFamilyHandle The column family to delete the key/value from
* @param key the specified key to be deleted.
+ * @param assumeTracked true when it is expected that the key is already
+ * tracked. More specifically, it means the the key was previous tracked
+ * in the same savepoint, with the same exclusive flag, and at a lower
+ * sequence number. If valid then it skips ValidateSnapshot,
+ * throws an error otherwise.
*
* @throws RocksDBException when one of the TransactionalDB conditions
* described above occurs, or in the case of an unexpected error
*/
- public void delete(final ColumnFamilyHandle columnFamilyHandle, final byte[] key,
- final boolean assume_tracked) throws RocksDBException {
+ public void delete(final ColumnFamilyHandle columnFamilyHandle,
+ final byte[] key, final boolean assumeTracked) throws RocksDBException {
assert (isOwningHandle());
- delete(nativeHandle_, key, key.length, columnFamilyHandle.nativeHandle_, assume_tracked);
+ delete(nativeHandle_, key, key.length, columnFamilyHandle.nativeHandle_,
+ assumeTracked);
}
- /*
- * Same as
- * {@link #delete(ColumnFamilyHandle, byte[], boolean)}
- * with assume_tracked=false.
+ /**
+ * Similar to {@link #delete(ColumnFamilyHandle, byte[], boolean)}
+ * but with {@code assumeTracked = false}.
+ *
+ * Will also perform conflict checking on the keys be written.
+ *
+ * If this Transaction was created on an {@link OptimisticTransactionDB},
+ * these functions should always succeed.
+ *
+ * If this Transaction was created on a {@link TransactionDB}, an
+ * {@link RocksDBException} may be thrown with an accompanying {@link Status}
+ * when:
+ * {@link Status.Code#Busy} if there is a write conflict,
+ * {@link Status.Code#TimedOut} if a lock could not be acquired,
+ * {@link Status.Code#TryAgain} if the memtable history size is not large
+ * enough. See
+ * {@link ColumnFamilyOptions#maxWriteBufferNumberToMaintain()}
+ *
+ * @param columnFamilyHandle The column family to delete the key/value from
+ * @param key the specified key to be deleted.
+ *
+ * @throws RocksDBException when one of the TransactionalDB conditions
+ * described above occurs, or in the case of an unexpected error
*/
public void delete(final ColumnFamilyHandle columnFamilyHandle,
final byte[] key) throws RocksDBException {
assert(isOwningHandle());
delete(nativeHandle_, key, key.length, columnFamilyHandle.nativeHandle_,
- /*assume_tracked*/ false);
+ /*assumeTracked*/ false);
}
/**
*
* @param columnFamilyHandle The column family to delete the key/value from
* @param keyParts the specified key to be deleted.
+ * @param assumeTracked true when it is expected that the key is already
+ * tracked. More specifically, it means the the key was previous tracked
+ * in the same savepoint, with the same exclusive flag, and at a lower
+ * sequence number. If valid then it skips ValidateSnapshot,
+ * throws an error otherwise.
*
* @throws RocksDBException when one of the TransactionalDB conditions
* described above occurs, or in the case of an unexpected error
*/
- public void delete(final ColumnFamilyHandle columnFamilyHandle, final byte[][] keyParts,
- final boolean assume_tracked) throws RocksDBException {
+ public void delete(final ColumnFamilyHandle columnFamilyHandle,
+ final byte[][] keyParts, final boolean assumeTracked)
+ throws RocksDBException {
assert (isOwningHandle());
- delete(
- nativeHandle_, keyParts, keyParts.length, columnFamilyHandle.nativeHandle_, assume_tracked);
+ delete(nativeHandle_, keyParts, keyParts.length,
+ columnFamilyHandle.nativeHandle_, assumeTracked);
}
- /*
- * Same as
- * {@link #delete(ColumnFamilyHandle, byte[][], boolean)}
- * with assume_tracked=false.
+ /**
+ * Similar to{@link #delete(ColumnFamilyHandle, byte[][], boolean)}
+ * but with {@code assumeTracked = false}.
+ *
+ * Allows you to specify the key in several parts that will be
+ * concatenated together.
+ *
+ * @param columnFamilyHandle The column family to delete the key/value from
+ * @param keyParts the specified key to be deleted.
+ *
+ * @throws RocksDBException when one of the TransactionalDB conditions
+ * described above occurs, or in the case of an unexpected error
*/
public void delete(final ColumnFamilyHandle columnFamilyHandle,
final byte[][] keyParts) throws RocksDBException {
assert(isOwningHandle());
- delete(nativeHandle_, keyParts, keyParts.length, columnFamilyHandle.nativeHandle_,
- /*assume_tracked*/ false);
+ delete(nativeHandle_, keyParts, keyParts.length,
+ columnFamilyHandle.nativeHandle_, false);
}
//TODO(AR) refactor if we implement org.rocksdb.SliceParts in future
*
* @param columnFamilyHandle The column family to delete the key/value from
* @param key the specified key to be deleted.
+ * @param assumeTracked true when it is expected that the key is already
+ * tracked. More specifically, it means the the key was previous tracked
+ * in the same savepoint, with the same exclusive flag, and at a lower
+ * sequence number. If valid then it skips ValidateSnapshot,
+ * throws an error otherwise.
*
* @throws RocksDBException when one of the TransactionalDB conditions
* described above occurs, or in the case of an unexpected error
*/
@Experimental("Performance optimization for a very specific workload")
- public void singleDelete(final ColumnFamilyHandle columnFamilyHandle, final byte[] key,
- final boolean assume_tracked) throws RocksDBException {
+ public void singleDelete(final ColumnFamilyHandle columnFamilyHandle,
+ final byte[] key, final boolean assumeTracked) throws RocksDBException {
assert (isOwningHandle());
- singleDelete(nativeHandle_, key, key.length, columnFamilyHandle.nativeHandle_, assume_tracked);
+ singleDelete(nativeHandle_, key, key.length,
+ columnFamilyHandle.nativeHandle_, assumeTracked);
}
- /*
- * Same as
- * {@link #singleDelete(ColumnFamilyHandle, byte[], boolean)}
- * with assume_tracked=false.
+ /**
+ * Similar to {@link #singleDelete(ColumnFamilyHandle, byte[], boolean)}
+ * but with {@code assumeTracked = false}.
+ *
+ * will also perform conflict checking on the keys be written.
+ *
+ * If this Transaction was created on an {@link OptimisticTransactionDB},
+ * these functions should always succeed.
+ *
+ * If this Transaction was created on a {@link TransactionDB}, an
+ * {@link RocksDBException} may be thrown with an accompanying {@link Status}
+ * when:
+ * {@link Status.Code#Busy} if there is a write conflict,
+ * {@link Status.Code#TimedOut} if a lock could not be acquired,
+ * {@link Status.Code#TryAgain} if the memtable history size is not large
+ * enough. See
+ * {@link ColumnFamilyOptions#maxWriteBufferNumberToMaintain()}
+ *
+ * @param columnFamilyHandle The column family to delete the key/value from
+ * @param key the specified key to be deleted.
+ *
+ * @throws RocksDBException when one of the TransactionalDB conditions
+ * described above occurs, or in the case of an unexpected error
*/
@Experimental("Performance optimization for a very specific workload")
- public void singleDelete(final ColumnFamilyHandle columnFamilyHandle, final byte[] key)
- throws RocksDBException {
+ public void singleDelete(final ColumnFamilyHandle columnFamilyHandle,
+ final byte[] key) throws RocksDBException {
assert(isOwningHandle());
- singleDelete(nativeHandle_, key, key.length, columnFamilyHandle.nativeHandle_,
- /*assume_tracked*/ false);
+ singleDelete(nativeHandle_, key, key.length,
+ columnFamilyHandle.nativeHandle_, false);
}
/**
*
* @param columnFamilyHandle The column family to delete the key/value from
* @param keyParts the specified key to be deleted.
+ * @param assumeTracked true when it is expected that the key is already
+ * tracked. More specifically, it means the the key was previous tracked
+ * in the same savepoint, with the same exclusive flag, and at a lower
+ * sequence number. If valid then it skips ValidateSnapshot,
+ * throws an error otherwise.
*
* @throws RocksDBException when one of the TransactionalDB conditions
* described above occurs, or in the case of an unexpected error
*/
@Experimental("Performance optimization for a very specific workload")
- public void singleDelete(final ColumnFamilyHandle columnFamilyHandle, final byte[][] keyParts,
- final boolean assume_tracked) throws RocksDBException {
+ public void singleDelete(final ColumnFamilyHandle columnFamilyHandle,
+ final byte[][] keyParts, final boolean assumeTracked)
+ throws RocksDBException {
assert (isOwningHandle());
- singleDelete(
- nativeHandle_, keyParts, keyParts.length, columnFamilyHandle.nativeHandle_, assume_tracked);
+ singleDelete(nativeHandle_, keyParts, keyParts.length,
+ columnFamilyHandle.nativeHandle_, assumeTracked);
}
- /*
- * Same as
- * {@link #singleDelete(ColumnFamilyHandle, byte[][], boolean)}
- * with assume_tracked=false.
+ /**
+ * Similar to{@link #singleDelete(ColumnFamilyHandle, byte[][], boolean)}
+ * but with {@code assumeTracked = false}.
+ *
+ * Allows you to specify the key in several parts that will be
+ * concatenated together.
+ *
+ * @param columnFamilyHandle The column family to delete the key/value from
+ * @param keyParts the specified key to be deleted.
+ *
+ * @throws RocksDBException when one of the TransactionalDB conditions
+ * described above occurs, or in the case of an unexpected error
*/
@Experimental("Performance optimization for a very specific workload")
- public void singleDelete(final ColumnFamilyHandle columnFamilyHandle, final byte[][] keyParts)
- throws RocksDBException {
+ public void singleDelete(final ColumnFamilyHandle columnFamilyHandle,
+ final byte[][] keyParts) throws RocksDBException {
assert(isOwningHandle());
- singleDelete(nativeHandle_, keyParts, keyParts.length, columnFamilyHandle.nativeHandle_,
- /*assume_tracked*/ false);
+ singleDelete(nativeHandle_, keyParts, keyParts.length,
+ columnFamilyHandle.nativeHandle_, false);
}
//TODO(AR) refactor if we implement org.rocksdb.SliceParts in future
throws RocksDBException;
private native byte[] getForUpdate(final long handle, final long readOptionsHandle,
final byte key[], final int keyLength, final long columnFamilyHandle, final boolean exclusive,
- final boolean do_validate) throws RocksDBException;
+ final boolean doValidate) throws RocksDBException;
private native byte[] getForUpdate(final long handle, final long readOptionsHandle,
- final byte key[], final int keyLen, final boolean exclusive, final boolean do_validate)
+ final byte key[], final int keyLen, final boolean exclusive, final boolean doValidate)
throws RocksDBException;
private native byte[][] multiGetForUpdate(final long handle,
final long readOptionsHandle, final byte[][] keys,
final long readOptionsHandle, final long columnFamilyHandle);
private native void put(final long handle, final byte[] key, final int keyLength,
final byte[] value, final int valueLength, final long columnFamilyHandle,
- final boolean assume_tracked) throws RocksDBException;
+ final boolean assumeTracked) throws RocksDBException;
private native void put(final long handle, final byte[] key,
final int keyLength, final byte[] value, final int valueLength)
throws RocksDBException;
private native void put(final long handle, final byte[][] keys, final int keysLength,
final byte[][] values, final int valuesLength, final long columnFamilyHandle,
- final boolean assume_tracked) throws RocksDBException;
+ final boolean assumeTracked) throws RocksDBException;
private native void put(final long handle, final byte[][] keys,
final int keysLength, final byte[][] values, final int valuesLength)
throws RocksDBException;
private native void merge(final long handle, final byte[] key, final int keyLength,
final byte[] value, final int valueLength, final long columnFamilyHandle,
- final boolean assume_tracked) throws RocksDBException;
+ final boolean assumeTracked) throws RocksDBException;
private native void merge(final long handle, final byte[] key,
final int keyLength, final byte[] value, final int valueLength)
throws RocksDBException;
private native void delete(final long handle, final byte[] key, final int keyLength,
- final long columnFamilyHandle, final boolean assume_tracked) throws RocksDBException;
+ final long columnFamilyHandle, final boolean assumeTracked) throws RocksDBException;
private native void delete(final long handle, final byte[] key,
final int keyLength) throws RocksDBException;
private native void delete(final long handle, final byte[][] keys, final int keysLength,
- final long columnFamilyHandle, final boolean assume_tracked) throws RocksDBException;
+ final long columnFamilyHandle, final boolean assumeTracked) throws RocksDBException;
private native void delete(final long handle, final byte[][] keys,
final int keysLength) throws RocksDBException;
private native void singleDelete(final long handle, final byte[] key, final int keyLength,
- final long columnFamilyHandle, final boolean assume_tracked) throws RocksDBException;
+ final long columnFamilyHandle, final boolean assumeTracked) throws RocksDBException;
private native void singleDelete(final long handle, final byte[] key,
final int keyLength) throws RocksDBException;
private native void singleDelete(final long handle, final byte[][] keys, final int keysLength,
- final long columnFamilyHandle, final boolean assume_tracked) throws RocksDBException;
+ final long columnFamilyHandle, final boolean assumeTracked) throws RocksDBException;
private native void singleDelete(final long handle, final byte[][] keys,
final int keysLength) throws RocksDBException;
private native void putUntracked(final long handle, final byte[] key,