This is an automated email from the ASF dual-hosted git repository.

elek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hadoop-ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 73b87fd  HDDS-3776. Upgrading RocksDB version to avoid java heap issue 
(#1077)
73b87fd is described below

commit 73b87fd8ffbdace5d2ce98bce5d28c47cbc04ea9
Author: Elek, Márton <[email protected]>
AuthorDate: Wed Jun 17 17:51:25 2020 +0200

    HDDS-3776. Upgrading RocksDB version to avoid java heap issue (#1077)
---
 .../main/java/org/apache/hadoop/hdds/utils/db/RDBTable.java   | 11 ++++++-----
 .../java/org/apache/hadoop/hdds/utils/db/TestRDBStore.java    |  2 +-
 pom.xml                                                       |  2 +-
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git 
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBTable.java
 
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBTable.java
index eb181bf..2e390e2 100644
--- 
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBTable.java
+++ 
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBTable.java
@@ -26,6 +26,7 @@ import org.apache.hadoop.hdds.annotation.InterfaceAudience;
 import org.apache.hadoop.hdds.StringUtils;
 
 import org.rocksdb.ColumnFamilyHandle;
+import org.rocksdb.Holder;
 import org.rocksdb.ReadOptions;
 import org.rocksdb.RocksDB;
 import org.rocksdb.RocksDBException;
@@ -128,11 +129,12 @@ class RDBTable implements Table<byte[], byte[]> {
       // If the key definitely does not exist in the database, then this
       // method returns false, else true.
       rdbMetrics.incNumDBKeyMayExistChecks();
-      StringBuilder outValue = new StringBuilder();
+      Holder<byte[]> outValue = new Holder<>();
       boolean keyMayExist = db.keyMayExist(handle, key, outValue);
       if (keyMayExist) {
-        boolean keyExists = (outValue.length() > 0) ||
-            (db.get(handle, key) != null);
+        boolean keyExists =
+            (outValue.getValue() != null && outValue.getValue().length > 0) ||
+                (db.get(handle, key) != null);
         if (!keyExists) {
           rdbMetrics.incNumDBKeyMayExistMisses();
         }
@@ -162,8 +164,7 @@ class RDBTable implements Table<byte[], byte[]> {
       // If the key definitely does not exist in the database, then this
       // method returns false, else true.
       rdbMetrics.incNumDBKeyGetIfExistChecks();
-      StringBuilder outValue = new StringBuilder();
-      boolean keyMayExist = db.keyMayExist(handle, key, outValue);
+      boolean keyMayExist = db.keyMayExist(handle, key, null);
       if (keyMayExist) {
         // Not using out value from string builder, as that is causing
         // IllegalArgumentException during protobuf parsing.
diff --git 
a/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/utils/db/TestRDBStore.java
 
b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/utils/db/TestRDBStore.java
index d640c4a..600c48f 100644
--- 
a/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/utils/db/TestRDBStore.java
+++ 
b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/utils/db/TestRDBStore.java
@@ -315,7 +315,7 @@ public class TestRDBStore {
       for (int i = 0; i < 50; i++) {
         Assert.assertFalse(db.keyMayExist(
             org.apache.commons.codec.binary.StringUtils
-                .getBytesUtf16("key" + i), new StringBuilder()));
+                .getBytesUtf16("key" + i), null));
       }
       end = System.nanoTime();
       long keyMayExistLatency = end - start;
diff --git a/pom.xml b/pom.xml
index a676996..7663426 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1586,7 +1586,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xs
       <dependency>
         <groupId>org.rocksdb</groupId>
         <artifactId>rocksdbjni</artifactId>
-        <version>6.6.4</version>
+        <version>6.8.1</version>
       </dependency>
       <dependency>
         <groupId>org.xerial</groupId>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to