eolivelli commented on code in PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#discussion_r865692952
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorage.java:
##########
@@ -432,6 +447,19 @@ static long getLongVariableOrDefault(ServerConfiguration
conf, String keyName, l
}
}
+ static int getIntVariableOrDefault(ServerConfiguration conf, String
keyName, int defaultValue) {
Review Comment:
this should be moved to ServerConfiguration
##########
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:
if `hasFlushBeenTriggered.compareAndSet(false, true)` returns `false` we may
miss to release `maxPendingFlushCacheNum`
because `maxPendingFlushCacheNum.tryAcquire()` succeeded
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/WriteCacheContainer.java:
##########
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.bookkeeper.bookie.storage.ldb;
+
+import io.netty.buffer.ByteBufAllocator;
+import java.util.concurrent.LinkedBlockingQueue;
+
+/**
+ * Manage free write cache blocks.
+ */
+public class WriteCacheContainer {
+ private volatile LinkedBlockingQueue<WriteCache> freeBlockCaches = new
LinkedBlockingQueue<>();
Review Comment:
why `volatile` ? it should be `final`
--
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]