Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify incorrect rocksDB config level_compaction_dynamic_level_bytes to CFOptions #3860

Merged
merged 1 commit into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public void testRocksDBInitiateWithBookieConfiguration() throws Exception {
assertEquals(64 * 1024 * 1024, options.writeBufferSize());
assertEquals(4, options.maxWriteBufferNumber());
assertEquals(256 * 1024 * 1024, options.maxBytesForLevelBase());
assertEquals(true, options.levelCompactionDynamicLevelBytes());
rocksDB.close();
}

Expand All @@ -78,6 +79,7 @@ public void testRocksDBInitiateWithConfigurationFile() throws Exception {
assertEquals(CompressionType.LZ4_COMPRESSION, familyOptions.compressionType());
assertEquals(1024, familyOptions.writeBufferSize());
assertEquals(1, familyOptions.maxWriteBufferNumber());
assertEquals(true, familyOptions.levelCompactionDynamicLevelBytes());
rocksDB.close();
}

Expand Down Expand Up @@ -113,4 +115,20 @@ public void testReadChecksumTypeFromConfigurationFile() throws Exception {
// After the PR: https://github.com/facebook/rocksdb/pull/10826 merge, we can turn on this test.
assertEquals(ChecksumType.kxxHash, ((BlockBasedTableConfig) familyOptions.tableFormatConfig()).checksumType());
}

@Test
public void testLevelCompactionDynamicLevelBytesFromConfigurationFile() throws Exception {
ServerConfiguration configuration = new ServerConfiguration();
URL url = getClass().getClassLoader().getResource("conf/entry_location_rocksdb.conf");
configuration.setEntryLocationRocksdbConf(url.getPath());
File tmpDir = Files.createTempDirectory("bk-kv-rocksdbtest-file").toFile();
Files.createDirectory(Paths.get(tmpDir.toString(), "subDir"));
KeyValueStorageRocksDB rocksDB = new KeyValueStorageRocksDB(tmpDir.toString(), "subDir",
KeyValueStorageFactory.DbConfigType.EntryLocation, configuration);
assertNotNull(rocksDB.getColumnFamilyDescriptors());

List<ColumnFamilyDescriptor> columnFamilyDescriptorList = rocksDB.getColumnFamilyDescriptors();
ColumnFamilyOptions familyOptions = columnFamilyDescriptorList.get(0).getOptions();
assertEquals(true, familyOptions.levelCompactionDynamicLevelBytes());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
max_bytes_for_level_base=268435456
# set by jni: options.setTargetFileSizeBase
target_file_size_base=67108864
# set by jni: options.setLevelCompactionDynamicLevelBytes
level_compaction_dynamic_level_bytes=true

[TableOptions/BlockBasedTable "default"]
# set by jni: tableOptions.setBlockSize
Expand All @@ -64,6 +66,4 @@
# set by jni: tableOptions.setFilterPolicy, bloomfilter:[bits_per_key]:[use_block_based_builder]
filter_policy=rocksdb.BloomFilter:10:false
# set by jni: tableOptions.setCacheIndexAndFilterBlocks
cache_index_and_filter_blocks=true
# set by jni: options.setLevelCompactionDynamicLevelBytes
level_compaction_dynamic_level_bytes=true
cache_index_and_filter_blocks=true
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
write_buffer_size=1024
# set by jni: options.setMaxWriteBufferNumber
max_write_buffer_number=1
# set by jni: options.setLevelCompactionDynamicLevelBytes
level_compaction_dynamic_level_bytes=true

[TableOptions/BlockBasedTable "default"]
# set by jni: tableOptions.setBlockSize
Expand All @@ -44,6 +46,4 @@
# set by jni: tableOptions.setFilterPolicy, bloomfilter:[bits_per_key]:[use_block_based_builder]
filter_policy=rocksdb.BloomFilter:10:false
# set by jni: tableOptions.setCacheIndexAndFilterBlocks
cache_index_and_filter_blocks=true
# set by jni: options.setLevelCompactionDynamicLevelBytes
level_compaction_dynamic_level_bytes=true
cache_index_and_filter_blocks=true
6 changes: 3 additions & 3 deletions conf/entry_location_rocksdb.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
max_bytes_for_level_base=268435456
# set by jni: options.setTargetFileSizeBase
target_file_size_base=67108864
# set by jni: options.setLevelCompactionDynamicLevelBytes
level_compaction_dynamic_level_bytes=true

[TableOptions/BlockBasedTable "default"]
# set by jni: tableOptions.setBlockSize
Expand All @@ -64,6 +66,4 @@
# set by jni: tableOptions.setFilterPolicy, bloomfilter:[bits_per_key]:[use_block_based_builder]
filter_policy=rocksdb.BloomFilter:10:false
# set by jni: tableOptions.setCacheIndexAndFilterBlocks
cache_index_and_filter_blocks=true
# set by jni: options.setLevelCompactionDynamicLevelBytes
level_compaction_dynamic_level_bytes=true
cache_index_and_filter_blocks=true