Add kForceOptimized option to jni (#11181)

Summary:
Currently the option of "KForceOptimized" is not included in CompactRangeOptions.BottommostLevelCompaction.

This PR is to add this option.

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

Reviewed By: ajkr

Differential Revision: D43056453

Pulled By: cbi42

fbshipit-source-id: 22fd53f980ab1a86c61dd42e948902542065128f
oxigraph-8.1.1
Symious 2 years ago committed by Facebook GitHub Bot
parent 54d72085b5
commit 68fa90ca43
  1. 10
      java/src/main/java/org/rocksdb/CompactRangeOptions.java
  2. 3
      java/src/test/java/org/rocksdb/CompactRangeOptionsTest.java

@ -14,6 +14,7 @@ public class CompactRangeOptions extends RocksObject {
private final static byte VALUE_kSkip = 0;
private final static byte VALUE_kIfHaveCompactionFilter = 1;
private final static byte VALUE_kForce = 2;
private final static byte VALUE_kForceOptimized = 3;
// For level based compaction, we can configure if we want to skip/force bottommost level
// compaction. The order of this enum MUST follow the C++ layer. See BottommostLevelCompaction in
@ -30,7 +31,12 @@ public class CompactRangeOptions extends RocksObject {
/**
* Always compact bottommost level
*/
kForce(VALUE_kForce);
kForce(VALUE_kForce),
/**
* Always compact bottommost level but in bottommost level avoid
* double-compacting files created in the same compaction
*/
kForceOptimized(VALUE_kForceOptimized);
private final byte value;
@ -57,6 +63,8 @@ public class CompactRangeOptions extends RocksObject {
case VALUE_kSkip: return kSkip;
case VALUE_kIfHaveCompactionFilter: return kIfHaveCompactionFilter;
case VALUE_kForce: return kForce;
case VALUE_kForceOptimized:
return kForceOptimized;
default: return null;
}
}

@ -39,6 +39,9 @@ public class CompactRangeOptionsTest {
value = BottommostLevelCompaction.kIfHaveCompactionFilter;
opt.setBottommostLevelCompaction(value);
assertThat(opt.bottommostLevelCompaction()).isEqualTo(value);
value = BottommostLevelCompaction.kForceOptimized;
opt.setBottommostLevelCompaction(value);
assertThat(opt.bottommostLevelCompaction()).isEqualTo(value);
}
@Test

Loading…
Cancel
Save