You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/08/18 03:12:36 UTC

[GitHub] [pulsar] liangyuanpeng commented on a diff in pull request #17078: [Feat][metadata] RocksDB MetadataStore Support ReadOnly

liangyuanpeng commented on code in PR #17078:
URL: https://github.com/apache/pulsar/pull/17078#discussion_r948611361


##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/RocksdbMetadataStore.java:
##########
@@ -233,12 +240,15 @@ private RocksdbMetadataStore(String metadataURL, MetadataStoreConfig metadataSto
             throw new MetadataStoreException("Fail to create RocksDB file directory", e);
         }
 
+        readonly = "true".equalsIgnoreCase(
+                System.getProperty(ROCKSDB_READONLY, "false"));
         db = openDB(dataPath.toString(), metadataStoreConfig.getConfigFilePath());
 
         this.optionSync = new WriteOptions().setSync(true);
         this.optionDontSync = new WriteOptions().setSync(false);
         this.optionCache = new ReadOptions().setFillCache(true);
         this.optionDontCache = new ReadOptions().setFillCache(false);
+        dbStateLock = new ReentrantReadWriteLock();

Review Comment:
   You would got the NPE when init rocksdb failed,
   
   https://github.com/apache/pulsar/pull/17078/files#diff-d8d2e43e5722098642f3e3b650804e38c12c15cb9f5b92ed2f5a612618498d11R259



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org