michaeljmarshall commented on code in PR #4306:
URL: https://github.com/apache/bookkeeper/pull/4306#discussion_r1575217026
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/SingleDirectoryDbLedgerStorage.java:
##########
@@ -480,8 +480,12 @@ public long addEntry(ByteBuf entry) throws IOException,
BookieException {
long stamp = writeCacheRotationLock.tryOptimisticRead();
boolean inserted = false;
- inserted = writeCache.put(ledgerId, entryId, entry);
- if (!writeCacheRotationLock.validate(stamp)) {
+ // If the stamp is 0, the lock was exclusively acquired, validation
will fail, and we can skip this put.
Review Comment:
I looked closer, and it's only 0 when the lock is exclusively held, which
only happens when we call `swapWriteCache()`. That does not seem frequent
enough to bother with this special case, but I will wait for others to review
to confirm.
--
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]