lhotari commented on code in PR #4306:
URL: https://github.com/apache/bookkeeper/pull/4306#discussion_r1603203766


##########
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:
   It seems like there's invalid use of the StampedLock before this PR. Read 
operations are used for write operations. That's not supported by StampedLock. 
I don't see how that could be useful. 



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

Reply via email to