Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -288,42 +288,6 @@ public void testRocksDBCheckpointCleanup() throws Exception {
}
}

/**
* Not strictly a unit test. Just a confirmation of the expected behavior
* of RocksDB keyMayExist API.
* Expected behavior - On average, keyMayExist latency < key.get() latency
* for invalid keys.
* @throws Exception if unable to read from RocksDB.
*/
@Test
public void testRocksDBKeyMayExistApi() throws Exception {
try (RDBStore newStore =
new RDBStore(folder.newFolder(), options, configSet)) {
RocksDB db = newStore.getDb();

//Test with 50 invalid keys.
long start = System.nanoTime();
for (int i = 0; i < 50; i++) {
Assert.assertTrue(db.get(
org.apache.commons.codec.binary.StringUtils
.getBytesUtf16("key" + i)) == null);
}
long end = System.nanoTime();
long keyGetLatency = end - start;

start = System.nanoTime();
for (int i = 0; i < 50; i++) {
Assert.assertFalse(db.keyMayExist(
org.apache.commons.codec.binary.StringUtils
.getBytesUtf16("key" + i), null));
}
end = System.nanoTime();
long keyMayExistLatency = end - start;

Assert.assertTrue(keyMayExistLatency < keyGetLatency);
}
}

@Test
public void testGetDBUpdatesSince() throws Exception {

Expand Down