diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/KeyValueStorageRocksDB.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/KeyValueStorageRocksDB.java index 1120db2ce8a..b5c63687d0a 100644 --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/KeyValueStorageRocksDB.java +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/KeyValueStorageRocksDB.java @@ -82,6 +82,7 @@ public class KeyValueStorageRocksDB implements KeyValueStorage { private static final String ROCKSDB_NUM_LEVELS = "dbStorage_rocksDB_numLevels"; private static final String ROCKSDB_NUM_FILES_IN_LEVEL0 = "dbStorage_rocksDB_numFilesInLevel0"; private static final String ROCKSDB_MAX_SIZE_IN_LEVEL1_MB = "dbStorage_rocksDB_maxSizeInLevel1MB"; + private static final String ROCKSDB_FORMAT_VERSION = "dbStorage_rocksDB_format_version"; public KeyValueStorageRocksDB(String basePath, String subPath, DbConfigType dbConfigType, ServerConfiguration conf) throws IOException { @@ -121,6 +122,7 @@ public KeyValueStorageRocksDB(String basePath, String subPath, DbConfigType dbCo int blockSize = conf.getInt(ROCKSDB_BLOCK_SIZE, 64 * 1024); int bloomFilterBitsPerKey = conf.getInt(ROCKSDB_BLOOM_FILTERS_BITS_PER_KEY, 10); boolean lz4CompressionEnabled = conf.getBoolean(ROCKSDB_LZ4_COMPRESSION_ENABLED, true); + int formatVersion = conf.getInt(ROCKSDB_FORMAT_VERSION, 2); if (lz4CompressionEnabled) { options.setCompressionType(CompressionType.LZ4_COMPRESSION); @@ -143,7 +145,7 @@ public KeyValueStorageRocksDB(String basePath, String subPath, DbConfigType dbCo BlockBasedTableConfig tableOptions = new BlockBasedTableConfig(); tableOptions.setBlockSize(blockSize); tableOptions.setBlockCache(cache); - tableOptions.setFormatVersion(2); + tableOptions.setFormatVersion(formatVersion); tableOptions.setChecksumType(ChecksumType.kxxHash); if (bloomFilterBitsPerKey > 0) { tableOptions.setFilterPolicy(new BloomFilter(bloomFilterBitsPerKey, false)); diff --git a/conf/bk_server.conf b/conf/bk_server.conf index 3941fe1d9d1..f287512f7cb 100755 --- a/conf/bk_server.conf +++ b/conf/bk_server.conf @@ -726,6 +726,7 @@ ledgerDirectories=/tmp/bk-data # dbStorage_rocksDB_numFilesInLevel0=4 # dbStorage_rocksDB_maxSizeInLevel1MB=256 # dbStorage_rocksDB_logPath= +# dbStorage_rocksDB_format_version=2 ############################################## Metadata Services ##############################################