mirror of
https://github.com/facebook/rocksdb.git
synced 2026-07-07 14:47:40 +08:00
add unit test for compactRangeWithNullBoundaries java api (#12333)
Summary: The purpose of this PR is to supplement a set of unit tests for https://github.com/facebook/rocksdb/pull/12328 Pull Request resolved: https://github.com/facebook/rocksdb/pull/12333 Reviewed By: ltamasi Differential Revision: D53553830 Pulled By: cbi42 fbshipit-source-id: d21490f7ce7b30f42807ee37eda455ca6abdd072
This commit is contained in:
@@ -1136,6 +1136,40 @@ public class RocksDBTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void compactRangeWithNullBoundaries() throws RocksDBException {
|
||||
try (final Options opt = new Options()
|
||||
.setCreateIfMissing(true)
|
||||
.setDisableAutoCompactions(true)
|
||||
.setCompactionStyle(CompactionStyle.LEVEL)
|
||||
.setNumLevels(4)
|
||||
.setWriteBufferSize(100 << 10)
|
||||
.setLevelZeroFileNumCompactionTrigger(3)
|
||||
.setTargetFileSizeBase(200 << 10)
|
||||
.setTargetFileSizeMultiplier(1)
|
||||
.setMaxBytesForLevelBase(500 << 10)
|
||||
.setMaxBytesForLevelMultiplier(1)
|
||||
.setDisableAutoCompactions(true);
|
||||
final FlushOptions flushOptions = new FlushOptions();
|
||||
final RocksDB db = RocksDB.open(opt, dbFolder.getRoot().getAbsolutePath())) {
|
||||
final byte[] b = new byte[10000];
|
||||
// Create an SST containing key4, key5, and key6
|
||||
db.put(("key4").getBytes(), b);
|
||||
db.put(("key5").getBytes(), b);
|
||||
db.put(("key6").getBytes(), b);
|
||||
db.flush(flushOptions);
|
||||
// Create a new SST that includes the tombstones of all keys
|
||||
db.delete(("key4").getBytes());
|
||||
db.delete(("key5").getBytes());
|
||||
db.delete(("key6").getBytes());
|
||||
db.flush(flushOptions);
|
||||
|
||||
db.compactRange(("key4").getBytes(), null);
|
||||
List<LiveFileMetaData> liveFilesMetaData = db.getLiveFilesMetaData();
|
||||
assertThat(liveFilesMetaData.size()).isEqualTo(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void continueBackgroundWorkAfterCancelAllBackgroundWork() throws RocksDBException {
|
||||
final int KEY_SIZE = 20;
|
||||
|
||||
Reference in New Issue
Block a user