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 get the NPE in close method when init rocksdb failed. ~~In this
case, the reason is ReadOnly mode can not write data.~~
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]