From 8fd42cd7616be88344d2f165537d32adec126d98 Mon Sep 17 00:00:00 2001 From: Lari Hotari Date: Wed, 5 Mar 2025 15:27:03 +0200 Subject: [PATCH] Ensure that formatVersion is specified for all RocksDB dbs --- .../bookkeeper/bookie/storage/ldb/KeyValueStorageRocksDB.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 0c13c1c8bff..22c5bc75dbc 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 @@ -182,6 +182,7 @@ private RocksDB initializeRocksDBWithBookieConf(String basePath, String subPath, Options options = new Options(); options.setCreateIfMissing(true); ChecksumType checksumType = ChecksumType.valueOf(conf.getString(ROCKSDB_CHECKSUM_TYPE, "kxxHash")); + int formatVersion = conf.getInt(ROCKSDB_FORMAT_VERSION, 5); if (dbConfigType == DbConfigType.EntryLocation) { /* 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, 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, 5); if (lz4CompressionEnabled) { options.setCompressionType(CompressionType.LZ4_COMPRESSION); @@ -235,6 +235,7 @@ private RocksDB initializeRocksDBWithBookieConf(String basePath, String subPath, } else { this.cache = null; BlockBasedTableConfig tableOptions = new BlockBasedTableConfig(); + tableOptions.setFormatVersion(formatVersion); tableOptions.setChecksumType(checksumType); options.setTableFormatConfig(tableOptions); }