You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2019/06/25 19:49:56 UTC

[GitHub] [hadoop] bharatviswa504 commented on a change in pull request #1013: HDDS-1691 : RDBTable#isExist should use Rocksdb#keyMayExist

bharatviswa504 commented on a change in 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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org