You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2022/05/05 09:12:15 UTC

[GitHub] [bookkeeper] lordcheng10 commented on a diff in pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;

lordcheng10 commented on code in PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#discussion_r865705053


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/SingleDirectoryDbLedgerStorage.java:
##########
@@ -441,7 +468,16 @@ private void triggerFlushAndAddEntry(long ledgerId, long entryId, ByteBuf entry)
             // Write cache is full, we need to trigger a flush so that it gets rotated
             // If the flush has already been triggered or flush has already switched the
             // cache, we don't need to trigger another flush
-            if (!isFlushOngoing.get() && hasFlushBeenTriggered.compareAndSet(false, true)) {
+            if (maxPendingFlushCacheNum.tryAcquire() && hasFlushBeenTriggered.compareAndSet(false, true)) {

Review Comment:
   like this?
   if (hasFlushBeenTriggered.compareAndSet(false, true) && maxPendingFlushCacheNum.tryAcquire()){
   .....
   }



-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org