summaryrefslogtreecommitdiff
path: root/options/options_settable_test.cc
diff options
context:
space:
mode:
authorBaptiste Lemaire <blemaire@fb.com>2022-02-04 05:31:07 -0800
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>2022-02-04 05:32:28 -0800
commitbec9ab4316002257263aef3db254e6ae926eb100 (patch)
tree6c00366e3d0b30fa3264964d3602628f0ae211f2 /options/options_settable_test.cc
parent8b62abcc214cefbc4656080d2930375ef7820892 (diff)
Remove deprecated option DBOptions::max_mem_compaction_level (#9446)
Summary: In RocksDB, this option was already marked as "NOT SUPPORTED" for a long time, and setting this option does not have any effect on the behavior of RocksDB library. Therefore, we are removing it in the preparations of the upcoming 7.0 release. Pull Request resolved: https://github.com/facebook/rocksdb/pull/9446 Reviewed By: ajkr Differential Revision: D33793048 Pulled By: bjlemaire fbshipit-source-id: 73316efdb194e90225005246673dae99e65577ae
Diffstat (limited to 'options/options_settable_test.cc')
-rw-r--r--options/options_settable_test.cc17
1 files changed, 12 insertions, 5 deletions
diff --git a/options/options_settable_test.cc b/options/options_settable_test.cc
index 00899018e..d0585e5af 100644
--- a/options/options_settable_test.cc
+++ b/options/options_settable_test.cc
@@ -47,10 +47,16 @@ void FillWithSpecialChar(char* start_ptr, size_t total_size,
const OffsetGap& excluded,
char special_char = kSpecialChar) {
size_t offset = 0;
+ // The excluded vector contains pairs of bytes, (first, second).
+ // The first bytes are all set to the special char (represented as 'c' below).
+ // The second bytes are simply skipped (padding bytes).
+ // ccccc[skipped]cccccccc[skiped]cccccccc[skipped]
for (auto& pair : excluded) {
std::memset(start_ptr + offset, special_char, pair.first - offset);
offset = pair.first + pair.second;
}
+ // The rest of the structure is filled with the special characters.
+ // ccccc[skipped]cccccccc[skiped]cccccccc[skipped]cccccccccccccccc
std::memset(start_ptr + offset, special_char, total_size - offset);
}
@@ -59,6 +65,10 @@ int NumUnsetBytes(char* start_ptr, size_t total_size,
int total_unset_bytes_base = 0;
size_t offset = 0;
for (auto& pair : excluded) {
+ // The first part of the structure contains memory spaces that can be
+ // set (pair.first), and memory spaces that cannot be set (pair.second).
+ // Therefore total_unset_bytes_base only agregates bytes set to kSpecialChar
+ // in the pair.first bytes, but skips the pair.second bytes (padding bytes).
for (char* ptr = start_ptr + offset; ptr < start_ptr + pair.first; ptr++) {
if (*ptr == kSpecialChar) {
total_unset_bytes_base++;
@@ -66,6 +76,8 @@ int NumUnsetBytes(char* start_ptr, size_t total_size,
}
offset = pair.first + pair.second;
}
+ // Then total_unset_bytes_base aggregates the bytes
+ // set to kSpecialChar in the rest of the structure
for (char* ptr = start_ptr + offset; ptr < start_ptr + total_size; ptr++) {
if (*ptr == kSpecialChar) {
total_unset_bytes_base++;
@@ -422,10 +434,6 @@ TEST_F(OptionsSettableTest, ColumnFamilyOptionsAllFieldsSettable) {
// which did in fact modify padding bytes.
ColumnFamilyOptions* options = new (options_ptr) ColumnFamilyOptions();
- // Deprecatd option which is not initialized. Need to set it to avoid
- // Valgrind error
- options->max_mem_compaction_level = 0;
-
int unset_bytes_base = NumUnsetBytes(options_ptr, sizeof(ColumnFamilyOptions),
kColumnFamilyOptionsExcluded);
ASSERT_GT(unset_bytes_base, 0);
@@ -439,7 +447,6 @@ TEST_F(OptionsSettableTest, ColumnFamilyOptionsAllFieldsSettable) {
// GetColumnFamilyOptionsFromString():
options->compaction_options_universal = CompactionOptionsUniversal();
options->num_levels = 42; // Initialize options for MutableCF
- options->max_mem_compaction_level = 0;
options->compaction_filter = nullptr;
options->sst_partitioner_factory = nullptr;