diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorage.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorage.java index 24a52dc81a5..f9168fcf140 100644 --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorage.java +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorage.java @@ -60,6 +60,7 @@ import org.apache.bookkeeper.common.util.MathUtils; import org.apache.bookkeeper.common.util.Watcher; import org.apache.bookkeeper.common.util.nativeio.NativeIOImpl; +import org.apache.bookkeeper.conf.DbLedgerStorageConfiguration; import org.apache.bookkeeper.conf.ServerConfiguration; import org.apache.bookkeeper.meta.LedgerManager; import org.apache.bookkeeper.slogger.slf4j.Slf4jSlogger; @@ -78,40 +79,6 @@ @Slf4j public class DbLedgerStorage implements LedgerStorage { - public static final String WRITE_CACHE_MAX_SIZE_MB = "dbStorage_writeCacheMaxSizeMb"; - public static final String READ_AHEAD_CACHE_MAX_SIZE_MB = "dbStorage_readAheadCacheMaxSizeMb"; - public static final String DIRECT_IO_ENTRYLOGGER = "dbStorage_directIOEntryLogger"; - public static final String DIRECT_IO_ENTRYLOGGER_TOTAL_WRITEBUFFER_SIZE_MB = - "dbStorage_directIOEntryLoggerTotalWriteBufferSizeMb"; - public static final String DIRECT_IO_ENTRYLOGGER_TOTAL_READBUFFER_SIZE_MB = - "dbStorage_directIOEntryLoggerTotalReadBufferSizeMb"; - public static final String DIRECT_IO_ENTRYLOGGER_READBUFFER_SIZE_MB = - "dbStorage_directIOEntryLoggerReadBufferSizeMb"; - public static final String DIRECT_IO_ENTRYLOGGER_MAX_FD_CACHE_TIME_SECONDS = - "dbStorage_directIOEntryLoggerMaxFdCacheTimeSeconds"; - - static final String MAX_THROTTLE_TIME_MILLIS = "dbStorage_maxThrottleTimeMs"; - - private static final int MB = 1024 * 1024; - - private static final long DEFAULT_WRITE_CACHE_MAX_SIZE_MB = - (long) (0.25 * PlatformDependent.estimateMaxDirectMemory()) / MB; - private static final long DEFAULT_READ_CACHE_MAX_SIZE_MB = - (long) (0.25 * PlatformDependent.estimateMaxDirectMemory()) / MB; - - static final String READ_AHEAD_CACHE_BATCH_SIZE = "dbStorage_readAheadCacheBatchSize"; - private static final int DEFAULT_READ_AHEAD_CACHE_BATCH_SIZE = 100; - - private static final long DEFAULT_DIRECT_IO_TOTAL_WRITEBUFFER_SIZE_MB = - (long) (0.125 * PlatformDependent.estimateMaxDirectMemory()) - / MB; - private static final long DEFAULT_DIRECT_IO_TOTAL_READBUFFER_SIZE_MB = - (long) (0.125 * PlatformDependent.estimateMaxDirectMemory()) - / MB; - private static final long DEFAULT_DIRECT_IO_READBUFFER_SIZE_MB = 8; - - private static final int DEFAULT_DIRECT_IO_MAX_FD_CACHE_TIME_SECONDS = 300; - // use the storage assigned to ledger 0 for flags. // if the storage configuration changes, the flags may be lost // but in that case data integrity should kick off anyhow. @@ -146,19 +113,18 @@ public class DbLedgerStorage implements LedgerStorage { public void initialize(ServerConfiguration conf, LedgerManager ledgerManager, LedgerDirsManager ledgerDirsManager, LedgerDirsManager indexDirsManager, StatsLogger statsLogger, ByteBufAllocator allocator) throws IOException { - long writeCacheMaxSize = getLongVariableOrDefault(conf, WRITE_CACHE_MAX_SIZE_MB, - DEFAULT_WRITE_CACHE_MAX_SIZE_MB) * MB; - long readCacheMaxSize = getLongVariableOrDefault(conf, READ_AHEAD_CACHE_MAX_SIZE_MB, - DEFAULT_READ_CACHE_MAX_SIZE_MB) * MB; - boolean directIOEntryLogger = getBooleanVariableOrDefault(conf, DIRECT_IO_ENTRYLOGGER, false); + DbLedgerStorageConfiguration dbLedgerStorageConf = conf.toDbLedgerStorageConfiguration(); + long writeCacheMaxSize = dbLedgerStorageConf.getWriteCacheMaxSize(); + long readCacheMaxSize = dbLedgerStorageConf.getReadCacheMaxSize(); + boolean directIOEntryLogger = dbLedgerStorageConf.isDirectIOEntryLoggerEnabled(); this.allocator = allocator; this.numberOfDirs = ledgerDirsManager.getAllLedgerDirs().size(); log.info("Started Db Ledger Storage"); log.info(" - Number of directories: {}", numberOfDirs); - log.info(" - Write cache size: {} MB", writeCacheMaxSize / MB); - log.info(" - Read Cache: {} MB", readCacheMaxSize / MB); + log.info(" - Write cache size: {} MB", writeCacheMaxSize / 1024 / 1024); + log.info(" - Read Cache: {} MB", readCacheMaxSize / 1024 / 1024); if (readCacheMaxSize + writeCacheMaxSize > PlatformDependent.estimateMaxDirectMemory()) { throw new IOException("Read and write cache sizes exceed the configured max direct memory size"); @@ -170,7 +136,7 @@ public void initialize(ServerConfiguration conf, LedgerManager ledgerManager, Le long perDirectoryWriteCacheSize = writeCacheMaxSize / numberOfDirs; long perDirectoryReadCacheSize = readCacheMaxSize / numberOfDirs; - int readAheadCacheBatchSize = conf.getInt(READ_AHEAD_CACHE_BATCH_SIZE, DEFAULT_READ_AHEAD_CACHE_BATCH_SIZE); + int readAheadCacheBatchSize = dbLedgerStorageConf.getReadAheadCacheBatchSize(); gcExecutor = Executors.newSingleThreadScheduledExecutor(new DefaultThreadFactory("GarbageCollector")); @@ -194,22 +160,15 @@ public void initialize(ServerConfiguration conf, LedgerManager ledgerManager, Le EntryLogger entrylogger; if (directIOEntryLogger) { - long perDirectoryTotalWriteBufferSize = MB * getLongVariableOrDefault( - conf, - DIRECT_IO_ENTRYLOGGER_TOTAL_WRITEBUFFER_SIZE_MB, - DEFAULT_DIRECT_IO_TOTAL_WRITEBUFFER_SIZE_MB) / numberOfDirs; - long perDirectoryTotalReadBufferSize = MB * getLongVariableOrDefault( - conf, - DIRECT_IO_ENTRYLOGGER_TOTAL_READBUFFER_SIZE_MB, - DEFAULT_DIRECT_IO_TOTAL_READBUFFER_SIZE_MB) / numberOfDirs; - int readBufferSize = MB * (int) getLongVariableOrDefault( - conf, - DIRECT_IO_ENTRYLOGGER_READBUFFER_SIZE_MB, - DEFAULT_DIRECT_IO_READBUFFER_SIZE_MB); - int maxFdCacheTimeSeconds = (int) getLongVariableOrDefault( - conf, - DIRECT_IO_ENTRYLOGGER_MAX_FD_CACHE_TIME_SECONDS, - DEFAULT_DIRECT_IO_MAX_FD_CACHE_TIME_SECONDS); + long perDirectoryTotalWriteBufferSize = + dbLedgerStorageConf.getDirectIOEntryLoggerTotalWriteBufferSize() / numberOfDirs; + long perDirectoryTotalReadBufferSize = + dbLedgerStorageConf.getDirectIOEntryLoggerTotalReadBufferSize() / numberOfDirs; + + int readBufferSize = (int) dbLedgerStorageConf.getDirectIOEntryLoggerReadBufferSize(); + + int maxFdCacheTimeSeconds = (int) dbLedgerStorageConf.getDirectIOEntryLoggerMaxFDCacheTimeSeconds(); + Slf4jSlogger slog = new Slf4jSlogger(DbLedgerStorage.class); entryLoggerWriteExecutor = Executors.newSingleThreadExecutor( new DefaultThreadFactory("EntryLoggerWrite")); diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/SingleDirectoryDbLedgerStorage.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/SingleDirectoryDbLedgerStorage.java index 0c5f328d2d2..d8371dfd46e 100644 --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/SingleDirectoryDbLedgerStorage.java +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/SingleDirectoryDbLedgerStorage.java @@ -136,8 +136,6 @@ public class SingleDirectoryDbLedgerStorage implements CompactableLedgerStorage private final DbLedgerStorageStats dbLedgerStorageStats; - private static final long DEFAULT_MAX_THROTTLE_TIME_MILLIS = TimeUnit.SECONDS.toMillis(10); - private final long maxReadAheadBytesSize; private final Counter flushExecutorTime; @@ -175,8 +173,7 @@ public SingleDirectoryDbLedgerStorage(ServerConfiguration conf, LedgerManager le // Do not attempt to perform read-ahead more than half the total size of the cache maxReadAheadBytesSize = readCacheMaxSize / 2; - long maxThrottleTimeMillis = conf.getLong(DbLedgerStorage.MAX_THROTTLE_TIME_MILLIS, - DEFAULT_MAX_THROTTLE_TIME_MILLIS); + long maxThrottleTimeMillis = conf.toDbLedgerStorageConfiguration().getMaxThrottleTimeMillis(); maxThrottleTimeNanos = TimeUnit.MILLISECONDS.toNanos(maxThrottleTimeMillis); readCache = new ReadCache(allocator, readCacheMaxSize); diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/DbLedgerStorageConfiguration.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/DbLedgerStorageConfiguration.java new file mode 100644 index 00000000000..d972b410120 --- /dev/null +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/DbLedgerStorageConfiguration.java @@ -0,0 +1,161 @@ +/** + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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.conf; + +// CHECKSTYLE.OFF: IllegalImport +import com.google.common.annotations.VisibleForTesting; +import io.netty.buffer.PooledByteBufAllocator; +import io.netty.util.NettyRuntime; +import io.netty.util.internal.PlatformDependent; +import java.util.concurrent.TimeUnit; +import org.apache.commons.lang3.StringUtils; +// CHECKSTYLE.ON: IllegalImport + +public class DbLedgerStorageConfiguration extends ServerConfiguration { + + private static final int MB = 1024 * 1024; + + @VisibleForTesting + public static final String WRITE_CACHE_MAX_SIZE_MB = "dbStorage_writeCacheMaxSizeMb"; + + private static final long DEFAULT_WRITE_CACHE_MAX_SIZE_MB = + (long) (0.25 * PlatformDependent.estimateMaxDirectMemory()) / MB; + + @VisibleForTesting + public static final String READ_AHEAD_CACHE_MAX_SIZE_MB = "dbStorage_readAheadCacheMaxSizeMb"; + + private static final long DEFAULT_READ_CACHE_MAX_SIZE_MB = + (long) (0.25 * PlatformDependent.estimateMaxDirectMemory()) / MB; + + private static final String READ_AHEAD_CACHE_BATCH_SIZE = "dbStorage_readAheadCacheBatchSize"; + + private static final int DEFAULT_READ_AHEAD_CACHE_BATCH_SIZE = 100; + + private static final String DIRECT_IO_ENTRYLOGGER = "dbStorage_directIOEntryLogger"; + + private static final String DIRECT_IO_ENTRYLOGGER_TOTAL_WRITEBUFFER_SIZE_MB = + "dbStorage_directIOEntryLoggerTotalWriteBufferSizeMb"; + + private static final long DEFAULT_DIRECT_IO_TOTAL_WRITEBUFFER_SIZE_MB = + (long) (0.125 * PlatformDependent.estimateMaxDirectMemory()) / MB; + + private static final String DIRECT_IO_ENTRYLOGGER_TOTAL_READBUFFER_SIZE_MB = + "dbStorage_directIOEntryLoggerTotalReadBufferSizeMb"; + + private static final long DEFAULT_DIRECT_IO_TOTAL_READBUFFER_SIZE_MB = + (long) (0.125 * PlatformDependent.estimateMaxDirectMemory()) / MB; + + private static final String DIRECT_IO_ENTRYLOGGER_READBUFFER_SIZE_MB = + "dbStorage_directIOEntryLoggerReadBufferSizeMb"; + + private static final long DEFAULT_DIRECT_IO_READBUFFER_SIZE_MB = 8; + + private static final String DIRECT_IO_ENTRYLOGGER_MAX_FD_CACHE_TIME_SECONDS = + "dbStorage_directIOEntryLoggerMaxFdCacheTimeSeconds"; + + private static final int DEFAULT_DIRECT_IO_MAX_FD_CACHE_TIME_SECONDS = 300; + + @VisibleForTesting + public static final String MAX_THROTTLE_TIME_MILLIS = "dbStorage_maxThrottleTimeMs"; + + private static final long DEFAULT_MAX_THROTTLE_TIME_MILLIS = TimeUnit.SECONDS.toMillis(10); + + public long getWriteCacheMaxSize() { + return getLongVariableOrDefault(WRITE_CACHE_MAX_SIZE_MB, DEFAULT_WRITE_CACHE_MAX_SIZE_MB) * MB; + } + + public long getReadCacheMaxSize() { + return getLongVariableOrDefault(READ_AHEAD_CACHE_MAX_SIZE_MB, DEFAULT_READ_CACHE_MAX_SIZE_MB) * MB; + } + + public int getReadAheadCacheBatchSize() { + return this.getInt(READ_AHEAD_CACHE_BATCH_SIZE, DEFAULT_READ_AHEAD_CACHE_BATCH_SIZE); + } + + public boolean isDirectIOEntryLoggerEnabled() { + return getBooleanVariableOrDefault(DIRECT_IO_ENTRYLOGGER, false); + } + + public long getDirectIOEntryLoggerTotalWriteBufferSize() { + return getLongVariableOrDefault(DIRECT_IO_ENTRYLOGGER_TOTAL_WRITEBUFFER_SIZE_MB, + DEFAULT_DIRECT_IO_TOTAL_WRITEBUFFER_SIZE_MB) * MB; + } + + public long getDirectIOEntryLoggerTotalReadBufferSize() { + return getLongVariableOrDefault(DIRECT_IO_ENTRYLOGGER_TOTAL_READBUFFER_SIZE_MB, + DEFAULT_DIRECT_IO_TOTAL_READBUFFER_SIZE_MB) * MB; + } + + public long getDirectIOEntryLoggerReadBufferSize() { + return getLongVariableOrDefault(DIRECT_IO_ENTRYLOGGER_READBUFFER_SIZE_MB, DEFAULT_DIRECT_IO_READBUFFER_SIZE_MB) + * MB; + } + + public long getDirectIOEntryLoggerMaxFDCacheTimeSeconds() { + return getLongVariableOrDefault(DIRECT_IO_ENTRYLOGGER_MAX_FD_CACHE_TIME_SECONDS, + DEFAULT_DIRECT_IO_MAX_FD_CACHE_TIME_SECONDS); + } + + public long getMaxThrottleTimeMillis() { + return this.getLong(MAX_THROTTLE_TIME_MILLIS, DEFAULT_MAX_THROTTLE_TIME_MILLIS); + } + + /** + * The configured pooling concurrency for the allocator, if user config it, we should consider the unpooled direct + * memory which readCache and writeCache occupy when use DbLedgerStorage. + */ + public int getAllocatorPoolingConcurrency() { + long writeCacheSize = this.getWriteCacheMaxSize(); + long readCacheSize = this.getReadCacheMaxSize(); + long availableDirectMemory = PlatformDependent.maxDirectMemory() - writeCacheSize - readCacheSize; + int defaultMinNumArena = NettyRuntime.availableProcessors() * 2; + final int defaultChunkSize = + PooledByteBufAllocator.defaultPageSize() << PooledByteBufAllocator.defaultMaxOrder(); + int suitableNum = (int) (availableDirectMemory / defaultChunkSize / 2 / 3); + return Math.min(defaultMinNumArena, suitableNum); + } + + private long getLongVariableOrDefault(String keyName, long defaultValue) { + Object obj = this.getProperty(keyName); + if (obj instanceof Number) { + return ((Number) obj).longValue(); + } else if (obj == null) { + return defaultValue; + } else if (StringUtils.isEmpty(this.getString(keyName))) { + return defaultValue; + } else { + return this.getLong(keyName); + } + } + + private boolean getBooleanVariableOrDefault(String keyName, boolean defaultValue) { + Object obj = this.getProperty(keyName); + if (obj instanceof Boolean) { + return (Boolean) obj; + } else if (obj == null) { + return defaultValue; + } else if (StringUtils.isEmpty(this.getString(keyName))) { + return defaultValue; + } else { + return this.getBoolean(keyName); + } + } +} diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ServerConfiguration.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ServerConfiguration.java index eebda935595..a9c6cc1466b 100644 --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ServerConfiguration.java +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ServerConfiguration.java @@ -4012,4 +4012,19 @@ public ServerConfiguration setLedgerMetadataRocksdbConf(String ledgerMetadataRoc this.setProperty(LEDGER_METADATA_ROCKSDB_CONF, ledgerMetadataRocksdbConf); return this; } + + public DbLedgerStorageConfiguration toDbLedgerStorageConfiguration() { + DbLedgerStorageConfiguration dbLedgerStorageConfiguration = new DbLedgerStorageConfiguration(); + dbLedgerStorageConfiguration.copy(this); + return dbLedgerStorageConfiguration; + } + + public int getAllocatorPoolingConcurrency() { + String ledgerStorageClass = getLedgerStorageClass(); + if (DbLedgerStorage.class.getName().equals(ledgerStorageClass)) { + return toDbLedgerStorageConfiguration().getAllocatorPoolingConcurrency(); + } + return super.getAllocatorPoolingConcurrency(); + } + } diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorageBookieTest.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorageBookieTest.java index ec3d9bafb41..fddbcbea055 100644 --- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorageBookieTest.java +++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorageBookieTest.java @@ -26,6 +26,7 @@ import org.apache.bookkeeper.client.BookKeeper.DigestType; import org.apache.bookkeeper.client.LedgerHandle; import org.apache.bookkeeper.conf.ClientConfiguration; +import org.apache.bookkeeper.conf.DbLedgerStorageConfiguration; import org.apache.bookkeeper.test.BookKeeperClusterTestCase; import org.junit.Test; import org.slf4j.Logger; @@ -44,10 +45,10 @@ public DbLedgerStorageBookieTest() { baseConf.setGcWaitTime(60000); // Leave it empty to pickup default - baseConf.setProperty(DbLedgerStorage.WRITE_CACHE_MAX_SIZE_MB, ""); + baseConf.setProperty(DbLedgerStorageConfiguration.WRITE_CACHE_MAX_SIZE_MB, ""); // Configure explicitly with a int object - baseConf.setProperty(DbLedgerStorage.READ_AHEAD_CACHE_MAX_SIZE_MB, 16); + baseConf.setProperty(DbLedgerStorageConfiguration.READ_AHEAD_CACHE_MAX_SIZE_MB, 16); } @Test diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorageIndexDirTest.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorageIndexDirTest.java index 9a4156ed2fc..6bbc77c4ea4 100644 --- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorageIndexDirTest.java +++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorageIndexDirTest.java @@ -35,6 +35,7 @@ import org.apache.bookkeeper.bookie.BookieException; import org.apache.bookkeeper.bookie.BookieImpl; import org.apache.bookkeeper.bookie.TestBookieImpl; +import org.apache.bookkeeper.conf.DbLedgerStorageConfiguration; import org.apache.bookkeeper.conf.ServerConfiguration; import org.apache.bookkeeper.conf.TestBKConfiguration; import org.apache.bookkeeper.proto.BookieProtocol; @@ -72,8 +73,8 @@ public void setup() throws Exception { conf.setGcWaitTime(gcWaitTime); /** the testcase cover specify indexDir for the class {@link SingleDirectoryDbLedgerStorage} */ conf.setLedgerStorageClass(DbLedgerStorage.class.getName()); - conf.setProperty(DbLedgerStorage.WRITE_CACHE_MAX_SIZE_MB, 1); - conf.setProperty(DbLedgerStorage.MAX_THROTTLE_TIME_MILLIS, 1000); + conf.setProperty(DbLedgerStorageConfiguration.WRITE_CACHE_MAX_SIZE_MB, 1); + conf.setProperty(DbLedgerStorageConfiguration.MAX_THROTTLE_TIME_MILLIS, 1000); conf.setLedgerDirNames(new String[]{tmpLedgerDir.toString()}); conf.setIndexDirName(new String[]{tmpIndexDir.toString()}); Bookie bookie = new TestBookieImpl(conf); diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorageTest.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorageTest.java index 04d4e260823..09c503b59c5 100644 --- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorageTest.java +++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorageTest.java @@ -42,6 +42,7 @@ import org.apache.bookkeeper.bookie.LedgerStorage; import org.apache.bookkeeper.bookie.TestBookieImpl; import org.apache.bookkeeper.bookie.storage.EntryLogger; +import org.apache.bookkeeper.conf.DbLedgerStorageConfiguration; import org.apache.bookkeeper.conf.ServerConfiguration; import org.apache.bookkeeper.conf.TestBKConfiguration; import org.apache.bookkeeper.proto.BookieProtocol; @@ -251,8 +252,8 @@ public void doubleDirectory() throws Exception { File secondDir = new File(tmpDir, "dir2"); ServerConfiguration conf = TestBKConfiguration.newServerConfiguration(); conf.setGcWaitTime(gcWaitTime); - conf.setProperty(DbLedgerStorage.WRITE_CACHE_MAX_SIZE_MB, 4); - conf.setProperty(DbLedgerStorage.READ_AHEAD_CACHE_MAX_SIZE_MB, 4); + conf.setProperty(DbLedgerStorageConfiguration.WRITE_CACHE_MAX_SIZE_MB, 4); + conf.setProperty(DbLedgerStorageConfiguration.READ_AHEAD_CACHE_MAX_SIZE_MB, 4); conf.setLedgerStorageClass(DbLedgerStorage.class.getName()); conf.setLedgerDirNames(new String[] { firstDir.getCanonicalPath(), secondDir.getCanonicalPath() }); diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorageWriteCacheTest.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorageWriteCacheTest.java index 3e1d1a1f4d1..052bf1f0d0f 100644 --- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorageWriteCacheTest.java +++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorageWriteCacheTest.java @@ -35,6 +35,7 @@ import org.apache.bookkeeper.bookie.LedgerDirsManager; import org.apache.bookkeeper.bookie.TestBookieImpl; import org.apache.bookkeeper.bookie.storage.EntryLogger; +import org.apache.bookkeeper.conf.DbLedgerStorageConfiguration; import org.apache.bookkeeper.conf.ServerConfiguration; import org.apache.bookkeeper.conf.TestBKConfiguration; import org.apache.bookkeeper.meta.LedgerManager; @@ -112,8 +113,8 @@ public void setup() throws Exception { ServerConfiguration conf = TestBKConfiguration.newServerConfiguration(); conf.setGcWaitTime(gcWaitTime); conf.setLedgerStorageClass(MockedDbLedgerStorage.class.getName()); - conf.setProperty(DbLedgerStorage.WRITE_CACHE_MAX_SIZE_MB, 1); - conf.setProperty(DbLedgerStorage.MAX_THROTTLE_TIME_MILLIS, 1000); + conf.setProperty(DbLedgerStorageConfiguration.WRITE_CACHE_MAX_SIZE_MB, 1); + conf.setProperty(DbLedgerStorageConfiguration.MAX_THROTTLE_TIME_MILLIS, 1000); conf.setLedgerDirNames(new String[] { tmpDir.toString() }); Bookie bookie = new TestBookieImpl(conf); diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/conf/TestBKConfiguration.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/conf/TestBKConfiguration.java index a716f0e18a2..4778c1f2a7a 100644 --- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/conf/TestBKConfiguration.java +++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/conf/TestBKConfiguration.java @@ -25,7 +25,6 @@ import java.net.SocketException; import java.util.Collections; import java.util.Enumeration; -import org.apache.bookkeeper.bookie.storage.ldb.DbLedgerStorage; import org.apache.bookkeeper.common.allocator.PoolingPolicy; import org.apache.bookkeeper.util.PortManager; import org.slf4j.Logger; @@ -57,8 +56,8 @@ public static ServerConfiguration newServerConfiguration() { confReturn.setDiskUsageThreshold(0.999f); confReturn.setDiskUsageWarnThreshold(0.99f); confReturn.setAllocatorPoolingPolicy(PoolingPolicy.UnpooledHeap); - confReturn.setProperty(DbLedgerStorage.WRITE_CACHE_MAX_SIZE_MB, 4); - confReturn.setProperty(DbLedgerStorage.READ_AHEAD_CACHE_MAX_SIZE_MB, 4); + confReturn.setProperty(DbLedgerStorageConfiguration.WRITE_CACHE_MAX_SIZE_MB, 4); + confReturn.setProperty(DbLedgerStorageConfiguration.READ_AHEAD_CACHE_MAX_SIZE_MB, 4); /** * if testcase has zk error,just try 0 time for fast running */