[
https://issues.apache.org/jira/browse/HDDS-1691?focusedWorklogId=267005&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-267005
]
ASF GitHub Bot logged work on HDDS-1691:
----------------------------------------
Author: ASF GitHub Bot
Created on: 25/Jun/19 19:49
Start Date: 25/Jun/19 19:49
Worklog Time Spent: 10m
Work Description: bharatviswa504 commented on pull request #1013:
HDDS-1691 : RDBTable#isExist should use Rocksdb#keyMayExist
URL: https://github.com/apache/hadoop/pull/1013#discussion_r297363945
##########
File path:
hadoop-hdds/common/src/test/java/org/apache/hadoop/utils/db/TestRDBStore.java
##########
@@ -289,4 +290,41 @@ public void testRocksDBCheckpointCleanup() throws
Exception {
checkpoint.getCheckpointLocation()));
}
}
+
+ /**
+ * Not strictly a unit test. Just a confirmation of the expected behavior
+ * of RocksDB keyMayExist API.
+ * @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();
+
+ for (int i = 0; i < 100; i++) {
+ db.put(StringUtils.getBytesUtf16("key" + i),
+ StringUtils.getBytesUtf16("Value" + i));
+ }
+
+ long start = System.nanoTime();
+ for (int i = 0; i < 50; i++) {
+ Assert.assertTrue(db.get(
+ StringUtils.getBytesUtf16("key" + i))!= null);
+ }
+ long end = System.nanoTime();
+ long keyGetLatency = end - start;
+
+ start = System.nanoTime();
+ for (int i = 50; i < 100; i++) {
+ Assert.assertTrue(db.get(
+ StringUtils.getBytesUtf16("key" + i))!= null);
+ }
Review comment:
I have not understood how this test is actually testing the API?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 267005)
Time Spent: 0.5h (was: 20m)
> RDBTable#isExist should use Rocksdb#keyMayExist
> -----------------------------------------------
>
> Key: HDDS-1691
> URL: https://issues.apache.org/jira/browse/HDDS-1691
> Project: Hadoop Distributed Data Store
> Issue Type: Improvement
> Reporter: Mukul Kumar Singh
> Assignee: Aravindan Vijayan
> Priority: Major
> Labels: pull-request-available
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> RDBTable#isExist can use Rocksdb#keyMayExist, this avoids the cost of reading
> the value for the key.
> Please refer,
> https://github.com/facebook/rocksdb/blob/7a8d7358bb40b13a06c2c6adc62e80295d89ed05/java/src/main/java/org/rocksdb/RocksDB.java#L2184
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]