Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDDS-2919. Remove intermittent TestRDBStore#testRocksDBKeyMayExistApi #3028

Merged
merged 1 commit into from Feb 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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