mauricebarnum commented on a change in pull request #2868:
URL: https://github.com/apache/bookkeeper/pull/2868#discussion_r739404752
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/ReadCache.java
##########
@@ -76,18 +82,24 @@ public ReadCache(ByteBufAllocator allocator, long
maxCacheSize, int maxSegmentSi
cacheSegments.add(Unpooled.directBuffer(segmentSize, segmentSize));
cacheIndexes.add(new ConcurrentLongLongPairHashMap(4096, 2 *
Runtime.getRuntime().availableProcessors()));
}
+ isStorageShutdown = false;
}
@Override
public void close() {
cacheSegments.forEach(ByteBuf::release);
+ isStorageShutdown = true;
}
- public void put(long ledgerId, long entryId, ByteBuf entry) {
+ public void put(long ledgerId, long entryId, ByteBuf entry) throws
IOException {
int entrySize = entry.readableBytes();
int alignedSize = align64(entrySize);
lock.readLock().lock();
+ if (isStorageShutdown) {
+ LOG.error("Read cache has shutdown, not allowing put cache
operation");
+ throw new IOException();
Review comment:
why not just fail operations silently when shutting down? if higher
level can't handle a no-op put and a "not found" get, we have other problems.
--
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]