diff --git a/java/src/main/java/org/rocksdb/AbstractWriteBatch.java b/java/src/main/java/org/rocksdb/AbstractWriteBatch.java index cc8e5c741..9527a2fd9 100644 --- a/java/src/main/java/org/rocksdb/AbstractWriteBatch.java +++ b/java/src/main/java/org/rocksdb/AbstractWriteBatch.java @@ -43,32 +43,6 @@ public abstract class AbstractWriteBatch extends RocksObject columnFamilyHandle.nativeHandle_); } - @Override - @Deprecated - public void remove(byte[] key) throws RocksDBException { - delete(nativeHandle_, key, key.length); - } - - @Override - @Deprecated - public void remove(ColumnFamilyHandle columnFamilyHandle, byte[] key) - throws RocksDBException { - delete(nativeHandle_, key, key.length, columnFamilyHandle.nativeHandle_); - } - - @Override - @Deprecated - public void remove(final ByteBuffer key) throws RocksDBException { - this.delete(key); - } - - @Override - @Deprecated - public void remove(ColumnFamilyHandle columnFamilyHandle, final ByteBuffer key) - throws RocksDBException { - this.delete(columnFamilyHandle, key); - } - @Override public void put(final ByteBuffer key, final ByteBuffer value) throws RocksDBException { assert key.isDirect() && value.isDirect(); diff --git a/java/src/main/java/org/rocksdb/ColumnFamilyDescriptor.java b/java/src/main/java/org/rocksdb/ColumnFamilyDescriptor.java index 8bb570e5d..125a8dcf8 100644 --- a/java/src/main/java/org/rocksdb/ColumnFamilyDescriptor.java +++ b/java/src/main/java/org/rocksdb/ColumnFamilyDescriptor.java @@ -49,19 +49,6 @@ public class ColumnFamilyDescriptor { return columnFamilyName_; } - /** - * Retrieve name of column family. - * - * @return column family name. - * @since 3.10.0 - * - * @deprecated Use {@link #getName()} instead. - */ - @Deprecated - public byte[] columnFamilyName() { - return getName(); - } - /** * Retrieve assigned options instance. * @@ -71,18 +58,6 @@ public class ColumnFamilyDescriptor { return columnFamilyOptions_; } - /** - * Retrieve assigned options instance. - * - * @return Options instance assigned to this instance. - * - * @deprecated Use {@link #getOptions()} instead. - */ - @Deprecated - public ColumnFamilyOptions columnFamilyOptions() { - return getOptions(); - } - @Override public boolean equals(final Object o) { if (this == o) { diff --git a/java/src/main/java/org/rocksdb/RocksDB.java b/java/src/main/java/org/rocksdb/RocksDB.java index c7ad65684..dd8eb9bb7 100644 --- a/java/src/main/java/org/rocksdb/RocksDB.java +++ b/java/src/main/java/org/rocksdb/RocksDB.java @@ -9,7 +9,6 @@ import java.io.IOException; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Arrays; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicReference; @@ -1040,23 +1039,6 @@ public class RocksDB extends RocksObject { vOffset, vLen, columnFamilyHandle.nativeHandle_); } - /** - * Remove the database entry (if any) for "key". Returns OK on - * success, and a non-OK status on error. It is not an error if "key" - * did not exist in the database. - * - * @param key Key to delete within database - * - * @throws RocksDBException thrown if error happens in underlying - * native library. - * - * @deprecated Use {@link #delete(byte[])} - */ - @Deprecated - public void remove(final byte[] key) throws RocksDBException { - delete(key); - } - /** * Delete the database entry (if any) for "key". Returns OK on * success, and a non-OK status on error. It is not an error if "key" @@ -1090,26 +1072,6 @@ public class RocksDB extends RocksObject { delete(nativeHandle_, key, offset, len); } - /** - * Remove the database entry (if any) for "key". Returns OK on - * success, and a non-OK status on error. It is not an error if "key" - * did not exist in the database. - * - * @param columnFamilyHandle {@link org.rocksdb.ColumnFamilyHandle} - * instance - * @param key Key to delete within database - * - * @throws RocksDBException thrown if error happens in underlying - * native library. - * - * @deprecated Use {@link #delete(ColumnFamilyHandle, byte[])} - */ - @Deprecated - public void remove(final ColumnFamilyHandle columnFamilyHandle, - final byte[] key) throws RocksDBException { - delete(columnFamilyHandle, key); - } - /** * Delete the database entry (if any) for "key". Returns OK on * success, and a non-OK status on error. It is not an error if "key" @@ -1149,25 +1111,6 @@ public class RocksDB extends RocksObject { delete(nativeHandle_, key, offset, len, columnFamilyHandle.nativeHandle_); } - /** - * Remove the database entry (if any) for "key". Returns OK on - * success, and a non-OK status on error. It is not an error if "key" - * did not exist in the database. - * - * @param writeOpt WriteOptions to be used with delete operation - * @param key Key to delete within database - * - * @throws RocksDBException thrown if error happens in underlying - * native library. - * - * @deprecated Use {@link #delete(WriteOptions, byte[])} - */ - @Deprecated - public void remove(final WriteOptions writeOpt, final byte[] key) - throws RocksDBException { - delete(writeOpt, key); - } - /** * Delete the database entry (if any) for "key". Returns OK on * success, and a non-OK status on error. It is not an error if "key" @@ -1204,27 +1147,6 @@ public class RocksDB extends RocksObject { delete(nativeHandle_, writeOpt.nativeHandle_, key, offset, len); } - /** - * Remove the database entry (if any) for "key". Returns OK on - * success, and a non-OK status on error. It is not an error if "key" - * did not exist in the database. - * - * @param columnFamilyHandle {@link org.rocksdb.ColumnFamilyHandle} - * instance - * @param writeOpt WriteOptions to be used with delete operation - * @param key Key to delete within database - * - * @throws RocksDBException thrown if error happens in underlying - * native library. - * - * @deprecated Use {@link #delete(ColumnFamilyHandle, WriteOptions, byte[])} - */ - @Deprecated - public void remove(final ColumnFamilyHandle columnFamilyHandle, - final WriteOptions writeOpt, final byte[] key) throws RocksDBException { - delete(columnFamilyHandle, writeOpt, key); - } - /** * Delete the database entry (if any) for "key". Returns OK on * success, and a non-OK status on error. It is not an error if "key" @@ -2200,205 +2122,6 @@ public class RocksDB extends RocksObject { columnFamilyHandle.nativeHandle_); } - /** - * Returns a map of keys for which values were found in DB. - * - * @param keys List of keys for which values need to be retrieved. - * @return Map where key of map is the key passed by user and value for map - * entry is the corresponding value in DB. - * - * @throws RocksDBException thrown if error happens in underlying - * native library. - * - * @deprecated Consider {@link #multiGetAsList(List)} instead. - */ - @Deprecated - public Map multiGet(final List keys) - throws RocksDBException { - assert(keys.size() != 0); - - final byte[][] keysArray = keys.toArray(new byte[0][]); - final int[] keyOffsets = new int[keysArray.length]; - final int[] keyLengths = new int[keysArray.length]; - for(int i = 0; i < keyLengths.length; i++) { - keyLengths[i] = keysArray[i].length; - } - - final byte[][] values = multiGet(nativeHandle_, keysArray, keyOffsets, - keyLengths); - - final Map keyValueMap = - new HashMap<>(computeCapacityHint(values.length)); - for(int i = 0; i < values.length; i++) { - if(values[i] == null) { - continue; - } - - keyValueMap.put(keys.get(i), values[i]); - } - - return keyValueMap; - } - - /** - * Returns a map of keys for which values were found in DB. - *

- * Note: Every key needs to have a related column family name in - * {@code columnFamilyHandleList}. - *

- * - * @param columnFamilyHandleList {@link java.util.List} containing - * {@link org.rocksdb.ColumnFamilyHandle} instances. - * @param keys List of keys for which values need to be retrieved. - * @return Map where key of map is the key passed by user and value for map - * entry is the corresponding value in DB. - * - * @throws RocksDBException thrown if error happens in underlying - * native library. - * @throws IllegalArgumentException thrown if the size of passed keys is not - * equal to the amount of passed column family handles. - * - * @deprecated Consider {@link #multiGetAsList(List, List)} instead. - */ - @Deprecated - public Map multiGet( - final List columnFamilyHandleList, - final List keys) throws RocksDBException, - IllegalArgumentException { - assert(keys.size() != 0); - // Check if key size equals cfList size. If not a exception must be - // thrown. If not a Segmentation fault happens. - if (keys.size() != columnFamilyHandleList.size()) { - throw new IllegalArgumentException( - "For each key there must be a ColumnFamilyHandle."); - } - final long[] cfHandles = new long[columnFamilyHandleList.size()]; - for (int i = 0; i < columnFamilyHandleList.size(); i++) { - cfHandles[i] = columnFamilyHandleList.get(i).nativeHandle_; - } - - final byte[][] keysArray = keys.toArray(new byte[0][]); - final int[] keyOffsets = new int[keysArray.length]; - final int[] keyLengths = new int[keysArray.length]; - for(int i = 0; i < keyLengths.length; i++) { - keyLengths[i] = keysArray[i].length; - } - - final byte[][] values = multiGet(nativeHandle_, keysArray, keyOffsets, - keyLengths, cfHandles); - - final Map keyValueMap = - new HashMap<>(computeCapacityHint(values.length)); - for(int i = 0; i < values.length; i++) { - if (values[i] == null) { - continue; - } - keyValueMap.put(keys.get(i), values[i]); - } - return keyValueMap; - } - - /** - * Returns a map of keys for which values were found in DB. - * - * @param opt Read options. - * @param keys of keys for which values need to be retrieved. - * @return Map where key of map is the key passed by user and value for map - * entry is the corresponding value in DB. - * - * @throws RocksDBException thrown if error happens in underlying - * native library. - * - * @deprecated Consider {@link #multiGetAsList(ReadOptions, List)} instead. - */ - @Deprecated - public Map multiGet(final ReadOptions opt, - final List keys) throws RocksDBException { - assert(keys.size() != 0); - - final byte[][] keysArray = keys.toArray(new byte[0][]); - final int[] keyOffsets = new int[keysArray.length]; - final int[] keyLengths = new int[keysArray.length]; - for(int i = 0; i < keyLengths.length; i++) { - keyLengths[i] = keysArray[i].length; - } - - final byte[][] values = multiGet(nativeHandle_, opt.nativeHandle_, - keysArray, keyOffsets, keyLengths); - - final Map keyValueMap = - new HashMap<>(computeCapacityHint(values.length)); - for(int i = 0; i < values.length; i++) { - if(values[i] == null) { - continue; - } - - keyValueMap.put(keys.get(i), values[i]); - } - - return keyValueMap; - } - - /** - * Returns a map of keys for which values were found in DB. - *

- * Note: Every key needs to have a related column family name in - * {@code columnFamilyHandleList}. - *

- * - * @param opt Read options. - * @param columnFamilyHandleList {@link java.util.List} containing - * {@link org.rocksdb.ColumnFamilyHandle} instances. - * @param keys of keys for which values need to be retrieved. - * @return Map where key of map is the key passed by user and value for map - * entry is the corresponding value in DB. - * - * @throws RocksDBException thrown if error happens in underlying - * native library. - * @throws IllegalArgumentException thrown if the size of passed keys is not - * equal to the amount of passed column family handles. - * - * @deprecated Consider {@link #multiGetAsList(ReadOptions, List, List)} - * instead. - */ - @Deprecated - public Map multiGet(final ReadOptions opt, - final List columnFamilyHandleList, - final List keys) throws RocksDBException { - assert(keys.size() != 0); - // Check if key size equals cfList size. If not a exception must be - // thrown. If not a Segmentation fault happens. - if (keys.size()!=columnFamilyHandleList.size()){ - throw new IllegalArgumentException( - "For each key there must be a ColumnFamilyHandle."); - } - final long[] cfHandles = new long[columnFamilyHandleList.size()]; - for (int i = 0; i < columnFamilyHandleList.size(); i++) { - cfHandles[i] = columnFamilyHandleList.get(i).nativeHandle_; - } - - final byte[][] keysArray = keys.toArray(new byte[0][]); - final int[] keyOffsets = new int[keysArray.length]; - final int[] keyLengths = new int[keysArray.length]; - for(int i = 0; i < keyLengths.length; i++) { - keyLengths[i] = keysArray[i].length; - } - - final byte[][] values = multiGet(nativeHandle_, opt.nativeHandle_, - keysArray, keyOffsets, keyLengths, cfHandles); - - final Map keyValueMap - = new HashMap<>(computeCapacityHint(values.length)); - for(int i = 0; i < values.length; i++) { - if(values[i] == null) { - continue; - } - keyValueMap.put(keys.get(i), values[i]); - } - - return keyValueMap; - } - /** * Takes a list of keys, and returns a list of values for the given list of * keys. List will contain null for keys which could not be found. @@ -3581,9 +3304,7 @@ public class RocksDB extends RocksObject { * *

See also

*
    - *
  • {@link #compactRange(boolean, int, int)}
  • *
  • {@link #compactRange(byte[], byte[])}
  • - *
  • {@link #compactRange(byte[], byte[], boolean, int, int)}
  • *
* * @throws RocksDBException thrown if an error occurs within the native @@ -3602,15 +3323,8 @@ public class RocksDB extends RocksObject { *

See also

*
    *
  • - * {@link #compactRange(ColumnFamilyHandle, boolean, int, int)} - *
  • - *
  • * {@link #compactRange(ColumnFamilyHandle, byte[], byte[])} *
  • - *
  • - * {@link #compactRange(ColumnFamilyHandle, byte[], byte[], - * boolean, int, int)} - *
  • *
* * @param columnFamilyHandle {@link org.rocksdb.ColumnFamilyHandle} @@ -3635,8 +3349,6 @@ public class RocksDB extends RocksObject { *

See also

*
    *
  • {@link #compactRange()}
  • - *
  • {@link #compactRange(boolean, int, int)}
  • - *
  • {@link #compactRange(byte[], byte[], boolean, int, int)}
  • *
* * @param begin start of key range (included in range) @@ -3659,13 +3371,6 @@ public class RocksDB extends RocksObject { *

See also

*
    *
  • {@link #compactRange(ColumnFamilyHandle)}
  • - *
  • - * {@link #compactRange(ColumnFamilyHandle, boolean, int, int)} - *
  • - *
  • - * {@link #compactRange(ColumnFamilyHandle, byte[], byte[], - * boolean, int, int)} - *
  • *
* * @param columnFamilyHandle {@link org.rocksdb.ColumnFamilyHandle} @@ -3685,174 +3390,6 @@ public class RocksDB extends RocksObject { 0, columnFamilyHandle == null ? 0: columnFamilyHandle.nativeHandle_); } - /** - *

Range compaction of database.

- *

Note: After the database has been compacted, - * all data will have been pushed down to the last level containing - * any data.

- * - *

Compaction outputs should be placed in options.db_paths - * [target_path_id]. Behavior is undefined if target_path_id is - * out of range.

- * - *

See also

- *
    - *
  • {@link #compactRange()}
  • - *
  • {@link #compactRange(byte[], byte[])}
  • - *
  • {@link #compactRange(byte[], byte[], boolean, int, int)}
  • - *
- * - * @deprecated Use {@link #compactRange(ColumnFamilyHandle, byte[], byte[], CompactRangeOptions)} instead - * - * @param changeLevel reduce level after compaction - * @param targetLevel target level to compact to - * @param targetPathId the target path id of output path - * - * @throws RocksDBException thrown if an error occurs within the native - * part of the library. - */ - @Deprecated - public void compactRange(final boolean changeLevel, final int targetLevel, - final int targetPathId) throws RocksDBException { - compactRange(null, changeLevel, targetLevel, targetPathId); - } - - /** - *

Range compaction of column family.

- *

Note: After the database has been compacted, - * all data will have been pushed down to the last level containing - * any data.

- * - *

Compaction outputs should be placed in options.db_paths - * [target_path_id]. Behavior is undefined if target_path_id is - * out of range.

- * - *

See also

- *
    - *
  • {@link #compactRange(ColumnFamilyHandle)}
  • - *
  • - * {@link #compactRange(ColumnFamilyHandle, byte[], byte[])} - *
  • - *
  • - * {@link #compactRange(ColumnFamilyHandle, byte[], byte[], - * boolean, int, int)} - *
  • - *
- * - * @deprecated Use {@link #compactRange(ColumnFamilyHandle, byte[], byte[], CompactRangeOptions)} instead - * - * @param columnFamilyHandle {@link org.rocksdb.ColumnFamilyHandle} - * instance, or null for the default column family. - * @param changeLevel reduce level after compaction - * @param targetLevel target level to compact to - * @param targetPathId the target path id of output path - * - * @throws RocksDBException thrown if an error occurs within the native - * part of the library. - */ - @Deprecated - public void compactRange( - /* @Nullable */ final ColumnFamilyHandle columnFamilyHandle, - final boolean changeLevel, final int targetLevel, final int targetPathId) - throws RocksDBException { - final CompactRangeOptions options = new CompactRangeOptions(); - options.setChangeLevel(changeLevel); - options.setTargetLevel(targetLevel); - options.setTargetPathId(targetPathId); - compactRange(nativeHandle_, - null, -1, - null, -1, - options.nativeHandle_, - columnFamilyHandle == null ? 0 : columnFamilyHandle.nativeHandle_); - } - - /** - *

Range compaction of database.

- *

Note: After the database has been compacted, - * all data will have been pushed down to the last level containing - * any data.

- * - *

Compaction outputs should be placed in options.db_paths - * [target_path_id]. Behavior is undefined if target_path_id is - * out of range.

- * - *

See also

- *
    - *
  • {@link #compactRange()}
  • - *
  • {@link #compactRange(boolean, int, int)}
  • - *
  • {@link #compactRange(byte[], byte[])}
  • - *
- * - * @deprecated Use {@link #compactRange(ColumnFamilyHandle, byte[], byte[], CompactRangeOptions)} - * instead - * - * @param begin start of key range (included in range) - * @param end end of key range (excluded from range) - * @param changeLevel reduce level after compaction - * @param targetLevel target level to compact to - * @param targetPathId the target path id of output path - * - * @throws RocksDBException thrown if an error occurs within the native - * part of the library. - */ - @Deprecated - public void compactRange(final byte[] begin, final byte[] end, - final boolean changeLevel, final int targetLevel, - final int targetPathId) throws RocksDBException { - compactRange(null, begin, end, changeLevel, targetLevel, targetPathId); - } - - /** - *

Range compaction of column family.

- *

Note: After the database has been compacted, - * all data will have been pushed down to the last level containing - * any data.

- * - *

Compaction outputs should be placed in options.db_paths - * [target_path_id]. Behavior is undefined if target_path_id is - * out of range.

- * - *

See also

- *
    - *
  • {@link #compactRange(ColumnFamilyHandle)}
  • - *
  • - * {@link #compactRange(ColumnFamilyHandle, boolean, int, int)} - *
  • - *
  • - * {@link #compactRange(ColumnFamilyHandle, byte[], byte[])} - *
  • - *
- * - * @deprecated Use {@link #compactRange(ColumnFamilyHandle, byte[], byte[], CompactRangeOptions)} instead - * - * @param columnFamilyHandle {@link org.rocksdb.ColumnFamilyHandle} - * instance. - * @param begin start of key range (included in range) - * @param end end of key range (excluded from range) - * @param changeLevel reduce level after compaction - * @param targetLevel target level to compact to - * @param targetPathId the target path id of output path - * - * @throws RocksDBException thrown if an error occurs within the native - * part of the library. - */ - @Deprecated - public void compactRange( - /* @Nullable */ final ColumnFamilyHandle columnFamilyHandle, - final byte[] begin, final byte[] end, final boolean changeLevel, - final int targetLevel, final int targetPathId) - throws RocksDBException { - final CompactRangeOptions options = new CompactRangeOptions(); - options.setChangeLevel(changeLevel); - options.setTargetLevel(targetLevel); - options.setTargetPathId(targetPathId); - compactRange(nativeHandle_, - begin, begin == null ? -1 : begin.length, - end, end == null ? -1 : end.length, - options.nativeHandle_, - columnFamilyHandle == null ? 0 : columnFamilyHandle.nativeHandle_); - } - /** *

Range compaction of column family.

*

Note: After the database has been compacted, diff --git a/java/src/main/java/org/rocksdb/RocksMemEnv.java b/java/src/main/java/org/rocksdb/RocksMemEnv.java index 0afa5f662..39a6f6e1c 100644 --- a/java/src/main/java/org/rocksdb/RocksMemEnv.java +++ b/java/src/main/java/org/rocksdb/RocksMemEnv.java @@ -26,14 +26,6 @@ public class RocksMemEnv extends Env { super(createMemEnv(baseEnv.nativeHandle_)); } - /** - * @deprecated Use {@link #RocksMemEnv(Env)}. - */ - @Deprecated - public RocksMemEnv() { - this(Env.getDefault()); - } - private static native long createMemEnv(final long baseEnvHandle); @Override protected final native void disposeInternal(final long handle); } diff --git a/java/src/main/java/org/rocksdb/SstFileWriter.java b/java/src/main/java/org/rocksdb/SstFileWriter.java index c65479f83..fe00c1a12 100644 --- a/java/src/main/java/org/rocksdb/SstFileWriter.java +++ b/java/src/main/java/org/rocksdb/SstFileWriter.java @@ -17,25 +17,6 @@ public class SstFileWriter extends RocksObject { RocksDB.loadLibrary(); } - /** - * SstFileWriter Constructor. - * - * @param envOptions {@link org.rocksdb.EnvOptions} instance. - * @param options {@link org.rocksdb.Options} instance. - * @param comparator the comparator to specify the ordering of keys. - * - * @deprecated Use {@link #SstFileWriter(EnvOptions, Options)}. - * Passing an explicit comparator is deprecated in lieu of passing the - * comparator as part of options. Use the other constructor instead. - */ - @Deprecated - public SstFileWriter(final EnvOptions envOptions, final Options options, - final AbstractComparator comparator) { - super(newSstFileWriter( - envOptions.nativeHandle_, options.nativeHandle_, comparator.nativeHandle_, - comparator.getComparatorType().getValue())); - } - /** * SstFileWriter Constructor. * @@ -59,40 +40,6 @@ public class SstFileWriter extends RocksObject { open(nativeHandle_, filePath); } - /** - * Add a Put key with value to currently opened file. - * - * @param key the specified key to be inserted. - * @param value the value associated with the specified key. - * - * @throws RocksDBException thrown if error happens in underlying - * native library. - * - * @deprecated Use {@link #put(Slice, Slice)} - */ - @Deprecated - public void add(final Slice key, final Slice value) - throws RocksDBException { - put(nativeHandle_, key.getNativeHandle(), value.getNativeHandle()); - } - - /** - * Add a Put key with value to currently opened file. - * - * @param key the specified key to be inserted. - * @param value the value associated with the specified key. - * - * @throws RocksDBException thrown if error happens in underlying - * native library. - * - * @deprecated Use {@link #put(DirectSlice, DirectSlice)} - */ - @Deprecated - public void add(final DirectSlice key, final DirectSlice value) - throws RocksDBException { - put(nativeHandle_, key.getNativeHandle(), value.getNativeHandle()); - } - /** * Add a Put key with value to currently opened file. * diff --git a/java/src/main/java/org/rocksdb/WriteBatchInterface.java b/java/src/main/java/org/rocksdb/WriteBatchInterface.java index c4ac6eead..92caa22b3 100644 --- a/java/src/main/java/org/rocksdb/WriteBatchInterface.java +++ b/java/src/main/java/org/rocksdb/WriteBatchInterface.java @@ -93,54 +93,6 @@ public interface WriteBatchInterface { void merge(ColumnFamilyHandle columnFamilyHandle, byte[] key, byte[] value) throws RocksDBException; - /** - *

If the database contains a mapping for "key", erase it. Else do nothing.

- * - * @param key Key to delete within database - * - * @deprecated Use {@link #delete(byte[])} - * @throws RocksDBException thrown if error happens in underlying native library. - */ - @Deprecated - void remove(byte[] key) throws RocksDBException; - - /** - *

If column family contains a mapping for "key", erase it. Else do nothing.

- * - * @param columnFamilyHandle {@link ColumnFamilyHandle} instance - * @param key Key to delete within database - * - * @deprecated Use {@link #delete(ColumnFamilyHandle, byte[])} - * @throws RocksDBException thrown if error happens in underlying native library. - */ - @Deprecated - void remove(ColumnFamilyHandle columnFamilyHandle, byte[] key) throws RocksDBException; - - /** - *

If column family contains a mapping for "key", erase it. Else do nothing.

- * - * @param key Key to delete within database. It is using position and limit. - * Supports direct buffer only. - * - * @deprecated Use {@link #delete(ByteBuffer)} - * @throws RocksDBException thrown if error happens in underlying native library. - */ - @Deprecated void remove(final ByteBuffer key) throws RocksDBException; - - /** - *

If column family contains a mapping for "key", erase it. Else do nothing.

- * - * @param columnFamilyHandle {@link ColumnFamilyHandle} instance - * @param key Key to delete within database. It is using position and limit. - * Supports direct buffer only. - * - * @deprecated Use {@link #delete(ColumnFamilyHandle, ByteBuffer)} - * @throws RocksDBException thrown if error happens in underlying native library. - */ - @Deprecated - void remove(ColumnFamilyHandle columnFamilyHandle, final ByteBuffer key) - throws RocksDBException; - /** *

If the database contains a mapping for "key", erase it. Else do nothing.

* diff --git a/java/src/test/java/org/rocksdb/BytewiseComparatorRegressionTest.java b/java/src/test/java/org/rocksdb/BytewiseComparatorRegressionTest.java index 90682eae7..fe950362b 100644 --- a/java/src/test/java/org/rocksdb/BytewiseComparatorRegressionTest.java +++ b/java/src/test/java/org/rocksdb/BytewiseComparatorRegressionTest.java @@ -112,15 +112,15 @@ public class BytewiseComparatorRegressionTest { final EnvOptions envOpts = new EnvOptions(); final Options opts = new Options(); - final SstFileWriter writer = - new SstFileWriter(envOpts, opts, new BytewiseComparator(new ComparatorOptions())); + opts.setComparator(new BytewiseComparator(new ComparatorOptions())); + final SstFileWriter writer = new SstFileWriter(envOpts, opts); writer.open(tempSSTFile.getAbsolutePath()); final byte[] gKey = hexToByte("000000293030303030303030303030303030303030303032303736343730696E666F33"); final byte[] wKey = hexToByte("0000008d3030303030303030303030303030303030303030303437363433696e666f34"); - writer.add(new Slice(gKey), new Slice("dummyV1")); - writer.add(new Slice(wKey), new Slice("dummyV2")); + writer.put(new Slice(gKey), new Slice("dummyV1")); + writer.put(new Slice(wKey), new Slice("dummyV2")); writer.finish(); } } diff --git a/java/src/test/java/org/rocksdb/ColumnFamilyTest.java b/java/src/test/java/org/rocksdb/ColumnFamilyTest.java index 9fab479b2..e98327d93 100644 --- a/java/src/test/java/org/rocksdb/ColumnFamilyTest.java +++ b/java/src/test/java/org/rocksdb/ColumnFamilyTest.java @@ -579,31 +579,4 @@ public class ColumnFamilyTest { assertTrue(cf2.isOwningHandle()); } } - - @Test - @Deprecated - /** - * @deprecated Now explicitly closing instances of ColumnFamilyHandle is not required. - * RocksDB instance will take care of closing its associated ColumnFamilyHandle objects. - */ - public void testColumnFamilyCloseBeforeDb() throws RocksDBException { - final List cfNames = - Arrays.asList(new ColumnFamilyDescriptor(RocksDB.DEFAULT_COLUMN_FAMILY), - new ColumnFamilyDescriptor("new_cf".getBytes())); - final List columnFamilyHandleList = new ArrayList<>(); - - try (final DBOptions options = - new DBOptions().setCreateIfMissing(true).setCreateMissingColumnFamilies(true); - final RocksDB db = RocksDB.open( - options, dbFolder.getRoot().getAbsolutePath(), cfNames, columnFamilyHandleList)) { - try { - db.put("testKey".getBytes(), "tstValue".getBytes()); - // Do something... - } finally { - for (final ColumnFamilyHandle columnFamilyHandle : columnFamilyHandleList) { - columnFamilyHandle.close(); - } - } - } - } } diff --git a/java/src/test/java/org/rocksdb/RocksDBTest.java b/java/src/test/java/org/rocksdb/RocksDBTest.java index cf3b82972..4193bcb44 100644 --- a/java/src/test/java/org/rocksdb/RocksDBTest.java +++ b/java/src/test/java/org/rocksdb/RocksDBTest.java @@ -393,46 +393,6 @@ public class RocksDBTest { } } - @SuppressWarnings("deprecated") - @Test - public void multiGet() throws RocksDBException { - try (final RocksDB db = RocksDB.open(dbFolder.getRoot().getAbsolutePath()); - final ReadOptions rOpt = new ReadOptions()) { - db.put("key1".getBytes(), "value".getBytes()); - db.put("key2".getBytes(), "12345678".getBytes()); - List lookupKeys = new ArrayList<>(); - lookupKeys.add("key1".getBytes()); - lookupKeys.add("key2".getBytes()); - Map results = db.multiGet(lookupKeys); - assertThat(results).isNotNull(); - assertThat(results.values()).isNotNull(); - assertThat(results.values()). - contains("value".getBytes(), "12345678".getBytes()); - // test same method with ReadOptions - results = db.multiGet(rOpt, lookupKeys); - assertThat(results).isNotNull(); - assertThat(results.values()).isNotNull(); - assertThat(results.values()). - contains("value".getBytes(), "12345678".getBytes()); - - // remove existing key - lookupKeys.remove("key2".getBytes()); - // add non existing key - lookupKeys.add("key3".getBytes()); - results = db.multiGet(lookupKeys); - assertThat(results).isNotNull(); - assertThat(results.values()).isNotNull(); - assertThat(results.values()). - contains("value".getBytes()); - // test same call with readOptions - results = db.multiGet(rOpt, lookupKeys); - assertThat(results).isNotNull(); - assertThat(results.values()).isNotNull(); - assertThat(results.values()). - contains("value".getBytes()); - } - } - @Test public void multiGetAsList() throws RocksDBException { try (final RocksDB db = RocksDB.open(dbFolder.getRoot().getAbsolutePath()); diff --git a/java/src/test/java/org/rocksdb/SstFileWriterTest.java b/java/src/test/java/org/rocksdb/SstFileWriterTest.java index 0a5506fc1..87165bfe1 100644 --- a/java/src/test/java/org/rocksdb/SstFileWriterTest.java +++ b/java/src/test/java/org/rocksdb/SstFileWriterTest.java @@ -32,7 +32,7 @@ public class SstFileWriterTest { enum OpType { PUT, PUT_BYTES, PUT_DIRECT, MERGE, MERGE_BYTES, DELETE, DELETE_BYTES } - class KeyValueWithOp { + static class KeyValueWithOp { KeyValueWithOp(String key, String value, OpType opType) { this.key = key; this.value = value; @@ -51,9 +51,9 @@ public class SstFileWriterTest { return opType; } - private String key; - private String value; - private OpType opType; + private final String key; + private final String value; + private final OpType opType; }; private File newSstFile(final List keyValues,