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

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new ddc09d5  Fixed RocksDb storage options instantiation after library is 
loaded
ddc09d5 is described below

commit ddc09d55a4379846c68a56db56889cf94caa777d
Author: Matteo Merli <[email protected]>
AuthorDate: Wed Dec 13 12:18:44 2017 -0800

    Fixed RocksDb storage options instantiation after library is loaded
    
    In previous commit 8e6c1a2e76a, the initialization of some RocksDb option 
objects was done before the RocksDB JNI library was loaded, leading to 
exceptions.
    
    Author: Matteo Merli <[email protected]>
    
    Reviewers: Sijie Guo <[email protected]>
    
    This closes #840 from merlimat/key-value-storage
---
 .../bookie/storage/ldb/KeyValueStorageRocksDB.java       | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/KeyValueStorageRocksDB.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/KeyValueStorageRocksDB.java
index 0978fc0..ed40531 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/KeyValueStorageRocksDB.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/KeyValueStorageRocksDB.java
@@ -56,13 +56,13 @@ public class KeyValueStorageRocksDB implements 
KeyValueStorage {
 
     private final RocksDB db;
 
-    private final WriteOptions optionSync = new WriteOptions();
-    private final WriteOptions optionDontSync = new WriteOptions();
+    private final WriteOptions optionSync;
+    private final WriteOptions optionDontSync;
 
-    private final ReadOptions optionCache = new ReadOptions();
-    private final ReadOptions optionDontCache = new ReadOptions();
+    private final ReadOptions optionCache;
+    private final ReadOptions optionDontCache;
 
-    private final WriteBatch emptyBatch = new WriteBatch();
+    private final WriteBatch emptyBatch;
 
     private static final String ROCKSDB_LOG_LEVEL = 
"dbStorage_rocksDB_logLevel";
     private static final String ROCKSDB_WRITE_BUFFER_SIZE_MB = 
"dbStorage_rocksDB_writeBufferSizeMB";
@@ -86,6 +86,12 @@ public class KeyValueStorageRocksDB implements 
KeyValueStorage {
             throw new IOException("Failed to load RocksDB JNI library", t);
         }
 
+        this.optionSync = new WriteOptions();
+        this.optionDontSync = new WriteOptions();
+        this.optionCache = new ReadOptions();
+        this.optionDontCache = new ReadOptions();
+        this.emptyBatch = new WriteBatch();
+
         try (Options options = new Options()) {
             options.setCreateIfMissing(true);
 

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to