Skip to content

Commit 4d8b927

Browse files
authored
Ensure that formatVersion is specified for all RocksDB dbs (#4559)
1 parent ede1ba9 commit 4d8b927

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/KeyValueStorageRocksDB.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ private RocksDB initializeRocksDBWithBookieConf(String basePath, String subPath,
182182
Options options = new Options();
183183
options.setCreateIfMissing(true);
184184
ChecksumType checksumType = ChecksumType.valueOf(conf.getString(ROCKSDB_CHECKSUM_TYPE, "kxxHash"));
185+
int formatVersion = conf.getInt(ROCKSDB_FORMAT_VERSION, 5);
185186

186187
if (dbConfigType == DbConfigType.EntryLocation) {
187188
/* Set default RocksDB block-cache size to 10% / numberOfLedgers of direct memory, unless override */
@@ -198,7 +199,6 @@ private RocksDB initializeRocksDBWithBookieConf(String basePath, String subPath,
198199
int blockSize = conf.getInt(ROCKSDB_BLOCK_SIZE, 64 * 1024);
199200
int bloomFilterBitsPerKey = conf.getInt(ROCKSDB_BLOOM_FILTERS_BITS_PER_KEY, 10);
200201
boolean lz4CompressionEnabled = conf.getBoolean(ROCKSDB_LZ4_COMPRESSION_ENABLED, true);
201-
int formatVersion = conf.getInt(ROCKSDB_FORMAT_VERSION, 5);
202202

203203
if (lz4CompressionEnabled) {
204204
options.setCompressionType(CompressionType.LZ4_COMPRESSION);
@@ -235,6 +235,7 @@ private RocksDB initializeRocksDBWithBookieConf(String basePath, String subPath,
235235
} else {
236236
this.cache = null;
237237
BlockBasedTableConfig tableOptions = new BlockBasedTableConfig();
238+
tableOptions.setFormatVersion(formatVersion);
238239
tableOptions.setChecksumType(checksumType);
239240
options.setTableFormatConfig(tableOptions);
240241
}

0 commit comments

Comments
 (0)