This is an automated email from the ASF dual-hosted git repository.

lhotari pushed a commit to branch branch-4.15
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git

commit 5378d8a4435cfb059dccf8240c9f781fd81418ef
Author: Lari Hotari <[email protected]>
AuthorDate: Tue Apr 1 17:58:10 2025 +0300

    Ensure that formatVersion is specified for all RocksDB dbs (#4559)
    
    (cherry picked from commit 4d8b927945a4f235c4a91b3fc7387fa7bf939c0d)
---
 .../apache/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 613b1c187e..ee2c38609f 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
@@ -179,6 +179,7 @@ public class KeyValueStorageRocksDB implements 
KeyValueStorage {
         Options options = new Options();
         options.setCreateIfMissing(true);
         ChecksumType checksumType = 
ChecksumType.valueOf(conf.getString(ROCKSDB_CHECKSUM_TYPE, "kxxHash"));
+        int formatVersion = conf.getInt(ROCKSDB_FORMAT_VERSION, 2);
 
         if (dbConfigType == DbConfigType.EntryLocation) {
             /* Set default RocksDB block-cache size to 10% / numberOfLedgers 
of direct memory, unless override */
@@ -195,7 +196,6 @@ public class KeyValueStorageRocksDB implements 
KeyValueStorage {
             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);
@@ -232,6 +232,7 @@ public class KeyValueStorageRocksDB implements 
KeyValueStorage {
         } else {
             this.cache = null;
             BlockBasedTableConfig tableOptions = new BlockBasedTableConfig();
+            tableOptions.setFormatVersion(formatVersion);
             tableOptions.setChecksumType(checksumType);
             options.setTableFormatConfig(tableOptions);
         }

Reply via email to