Support CompactionPri::kRoundRobin in RocksJava (#10572)

Summary:
Pretty trivial — this PR just adds the new compaction priority to the Java API.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/10572

Reviewed By: hx235

Differential Revision: D39006523

Pulled By: ajkr

fbshipit-source-id: ea8d665817e7b05826c397afa41c3abcda81484e
main
Brendan MacDonell 2 years ago committed by Facebook GitHub Bot
parent 9f290a5d15
commit 418b36a9bc
  1. 3
      HISTORY.md
  2. 4
      java/rocksjni/portal.h
  3. 10
      java/src/main/java/org/rocksdb/CompactionPriority.java

@ -6,6 +6,9 @@
### Public API changes ### Public API changes
* Add `rocksdb_column_family_handle_get_id`, `rocksdb_column_family_handle_get_name` to get name, id of column family in C API * Add `rocksdb_column_family_handle_get_id`, `rocksdb_column_family_handle_get_name` to get name, id of column family in C API
### Java API Changes
* Add CompactionPriority.RoundRobin.
## 7.6.0 (08/19/2022) ## 7.6.0 (08/19/2022)
### New Features ### New Features
* Added `prepopulate_blob_cache` to ColumnFamilyOptions. If enabled, prepopulate warm/hot blobs which are already in memory into blob cache at the time of flush. On a flush, the blob that is in memory (in memtables) get flushed to the device. If using Direct IO, additional IO is incurred to read this blob back into memory again, which is avoided by enabling this option. This further helps if the workload exhibits high temporal locality, where most of the reads go to recently written data. This also helps in case of the remote file system since it involves network traffic and higher latencies. * Added `prepopulate_blob_cache` to ColumnFamilyOptions. If enabled, prepopulate warm/hot blobs which are already in memory into blob cache at the time of flush. On a flush, the blob that is in memory (in memtables) get flushed to the device. If using Direct IO, additional IO is incurred to read this blob back into memory again, which is avoided by enabling this option. This further helps if the workload exhibits high temporal locality, where most of the reads go to recently written data. This also helps in case of the remote file system since it involves network traffic and higher latencies.

@ -4622,6 +4622,8 @@ class CompactionPriorityJni {
return 0x2; return 0x2;
case ROCKSDB_NAMESPACE::CompactionPri::kMinOverlappingRatio: case ROCKSDB_NAMESPACE::CompactionPri::kMinOverlappingRatio:
return 0x3; return 0x3;
case ROCKSDB_NAMESPACE::CompactionPri::kRoundRobin:
return 0x4;
default: default:
return 0x0; // undefined return 0x0; // undefined
} }
@ -4640,6 +4642,8 @@ class CompactionPriorityJni {
return ROCKSDB_NAMESPACE::CompactionPri::kOldestSmallestSeqFirst; return ROCKSDB_NAMESPACE::CompactionPri::kOldestSmallestSeqFirst;
case 0x3: case 0x3:
return ROCKSDB_NAMESPACE::CompactionPri::kMinOverlappingRatio; return ROCKSDB_NAMESPACE::CompactionPri::kMinOverlappingRatio;
case 0x4:
return ROCKSDB_NAMESPACE::CompactionPri::kRoundRobin;
default: default:
// undefined/default // undefined/default
return ROCKSDB_NAMESPACE::CompactionPri::kByCompensatedSize; return ROCKSDB_NAMESPACE::CompactionPri::kByCompensatedSize;

@ -33,7 +33,15 @@ public enum CompactionPriority {
* and its size is the smallest. It in many cases can optimize write * and its size is the smallest. It in many cases can optimize write
* amplification. * amplification.
*/ */
MinOverlappingRatio((byte)0x3); MinOverlappingRatio((byte)0x3),
/**
* Keeps a cursor(s) of the successor of the file (key range) was/were
* compacted before, and always picks the next files (key range) in that
* level. The file picking process will cycle through all the files in a
* round-robin manner.
*/
RoundRobin((byte)0x4);
private final byte value; private final byte value;

Loading…
Cancel
Save