lhotari commented on code in PR #4243:
URL: https://github.com/apache/bookkeeper/pull/4243#discussion_r2046306609
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/KeyValueStorageRocksDB.java:
##########
@@ -285,41 +290,57 @@ private RocksDB initializeRocksDBWithBookieConf(String
basePath, String subPath,
@Override
public void close() throws IOException {
- db.close();
- if (cache != null) {
- cache.close();
- }
- if (options != null) {
- options.close();
- }
- optionSync.close();
- optionDontSync.close();
- optionCache.close();
- optionDontCache.close();
- emptyBatch.close();
+ writeLock.lock();
+ try {
+ closed = true;
+ db.close();
+ if (cache != null) {
+ cache.close();
+ }
+ if (options != null) {
+ options.close();
+ }
+ optionSync.close();
+ optionDontSync.close();
+ optionCache.close();
+ optionDontCache.close();
+ emptyBatch.close();
+ } finally {
+ writeLock.unlock();
+ }
}
@Override
public void put(byte[] key, byte[] value) throws IOException {
+ readLock.lock();
Review Comment:
There's an alternative PR #4581 which simply handles `close` and `count`
--
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]