diff --git a/db/column_family.cc b/db/column_family.cc index 02cb5035f..2b048576c 100644 --- a/db/column_family.cc +++ b/db/column_family.cc @@ -139,10 +139,8 @@ Status CheckConcurrentWritesSupported(const ColumnFamilyOptions& cf_options) { } ColumnFamilyOptions SanitizeOptions(const ImmutableDBOptions& db_options, - const InternalKeyComparator* icmp, const ColumnFamilyOptions& src) { ColumnFamilyOptions result = src; - result.comparator = icmp; size_t clamp_max = std::conditional< sizeof(size_t) == 4, std::integral_constant, std::integral_constant>::type::value; @@ -349,8 +347,7 @@ ColumnFamilyData::ColumnFamilyData( refs_(0), dropped_(false), internal_comparator_(cf_options.comparator), - initial_cf_options_( - SanitizeOptions(db_options, &internal_comparator_, cf_options)), + initial_cf_options_(SanitizeOptions(db_options, cf_options)), ioptions_(db_options, initial_cf_options_), mutable_cf_options_(initial_cf_options_), write_buffer_manager_(write_buffer_manager), diff --git a/db/column_family.h b/db/column_family.h index 57cb907d0..6353e9237 100644 --- a/db/column_family.h +++ b/db/column_family.h @@ -137,7 +137,6 @@ extern Status CheckConcurrentWritesSupported( const ColumnFamilyOptions& cf_options); extern ColumnFamilyOptions SanitizeOptions(const ImmutableDBOptions& db_options, - const InternalKeyComparator* icmp, const ColumnFamilyOptions& src); // Wrap user defined table proproties collector factories `from cf_options` // into internal ones in int_tbl_prop_collector_factories. Add a system internal diff --git a/db/column_family_test.cc b/db/column_family_test.cc index d29b532d6..9db46c61d 100644 --- a/db/column_family_test.cc +++ b/db/column_family_test.cc @@ -2182,8 +2182,8 @@ TEST_F(ColumnFamilyTest, SanitizeOptions) { original.write_buffer_size = l * 4 * 1024 * 1024 + i * 1024 * 1024 + j * 1024 + k; - ColumnFamilyOptions result = SanitizeOptions( - ImmutableDBOptions(db_options), nullptr, original); + ColumnFamilyOptions result = + SanitizeOptions(ImmutableDBOptions(db_options), original); ASSERT_TRUE(result.level0_stop_writes_trigger >= result.level0_slowdown_writes_trigger); ASSERT_TRUE(result.level0_slowdown_writes_trigger >= diff --git a/db/db_impl.cc b/db/db_impl.cc index dfc31d307..033f89170 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -122,12 +122,11 @@ struct DBImpl::WriteContext { }; Options SanitizeOptions(const std::string& dbname, - const InternalKeyComparator* icmp, const Options& src) { auto db_options = SanitizeOptions(dbname, DBOptions(src)); ImmutableDBOptions immutable_db_options(db_options); auto cf_options = - SanitizeOptions(immutable_db_options, icmp, ColumnFamilyOptions(src)); + SanitizeOptions(immutable_db_options, ColumnFamilyOptions(src)); return Options(db_options, cf_options); } diff --git a/db/db_impl.h b/db/db_impl.h index 0847954d8..87e9edfbb 100644 --- a/db/db_impl.h +++ b/db/db_impl.h @@ -1089,7 +1089,6 @@ class DBImpl : public DB { }; extern Options SanitizeOptions(const std::string& db, - const InternalKeyComparator* icmp, const Options& src); extern DBOptions SanitizeOptions(const std::string& db, const DBOptions& src); diff --git a/db/db_options_test.cc b/db/db_options_test.cc index a348bffc7..ad315c316 100644 --- a/db/db_options_test.cc +++ b/db/db_options_test.cc @@ -64,7 +64,7 @@ class DBOptionsTest : public DBTestBase { Options options; ImmutableDBOptions db_options(options); test::RandomInitCFOptions(&options, rnd); - auto sanitized_options = SanitizeOptions(db_options, nullptr, options); + auto sanitized_options = SanitizeOptions(db_options, options); auto opt_map = GetMutableCFOptionsMap(sanitized_options); delete options.compaction_filter; return opt_map; diff --git a/db/table_properties_collector_test.cc b/db/table_properties_collector_test.cc index 7d96d6d80..ab0d5a37b 100644 --- a/db/table_properties_collector_test.cc +++ b/db/table_properties_collector_test.cc @@ -391,7 +391,6 @@ void TestInternalKeyPropertiesCollector( // SanitizeOptions(). options.info_log = std::make_shared(); options = SanitizeOptions("db", // just a place holder - &pikc, options); ImmutableCFOptions ioptions(options); GetIntTblPropCollectorFactory(ioptions, &int_tbl_prop_collector_factories); diff --git a/table/block_based_table_builder.cc b/table/block_based_table_builder.cc index 344d8cac1..6a848ccdf 100644 --- a/table/block_based_table_builder.cc +++ b/table/block_based_table_builder.cc @@ -74,7 +74,7 @@ class IndexBuilder { Slice index_block_contents; std::unordered_map meta_blocks; }; - explicit IndexBuilder(const Comparator* comparator) + explicit IndexBuilder(const InternalKeyComparator* comparator) : comparator_(comparator) {} virtual ~IndexBuilder() {} @@ -107,7 +107,7 @@ class IndexBuilder { virtual size_t EstimatedSize() const = 0; protected: - const Comparator* comparator_; + const InternalKeyComparator* comparator_; }; // This index builder builds space-efficient index block. @@ -121,7 +121,7 @@ class IndexBuilder { // substitute key that serves the same function. class ShortenedIndexBuilder : public IndexBuilder { public: - explicit ShortenedIndexBuilder(const Comparator* comparator, + explicit ShortenedIndexBuilder(const InternalKeyComparator* comparator, int index_block_restart_interval) : IndexBuilder(comparator), index_block_builder_(index_block_restart_interval) {} @@ -180,7 +180,7 @@ class ShortenedIndexBuilder : public IndexBuilder { // data copy or small heap allocations for prefixes. class HashIndexBuilder : public IndexBuilder { public: - explicit HashIndexBuilder(const Comparator* comparator, + explicit HashIndexBuilder(const InternalKeyComparator* comparator, const SliceTransform* hash_key_extractor, int index_block_restart_interval) : IndexBuilder(comparator), @@ -269,7 +269,8 @@ class HashIndexBuilder : public IndexBuilder { namespace { // Create a index builder based on its type. -IndexBuilder* CreateIndexBuilder(IndexType type, const Comparator* comparator, +IndexBuilder* CreateIndexBuilder(IndexType type, + const InternalKeyComparator* comparator, const SliceTransform* prefix_extractor, int index_block_restart_interval) { switch (type) { @@ -893,8 +894,8 @@ Status BlockBasedTableBuilder::Finish() { r->table_options.filter_policy->Name() : ""; r->props.index_size = r->index_builder->EstimatedSize() + kBlockTrailerSize; - r->props.comparator_name = r->ioptions.comparator != nullptr - ? r->ioptions.comparator->Name() + r->props.comparator_name = r->ioptions.user_comparator != nullptr + ? r->ioptions.user_comparator->Name() : "nullptr"; r->props.merge_operator_name = r->ioptions.merge_operator != nullptr ? r->ioptions.merge_operator->Name() diff --git a/table/table_reader_bench.cc b/table/table_reader_bench.cc index b04c5657b..ccdd5c146 100644 --- a/table/table_reader_bench.cc +++ b/table/table_reader_bench.cc @@ -168,10 +168,10 @@ void TableReaderBenchmark(Options& opts, EnvOptions& env_options, if (!through_db) { std::string value; MergeContext merge_context; - GetContext get_context(ioptions.comparator, ioptions.merge_operator, - ioptions.info_log, ioptions.statistics, - GetContext::kNotFound, Slice(key), &value, - nullptr, &merge_context, env); + GetContext get_context( + ioptions.user_comparator, ioptions.merge_operator, + ioptions.info_log, ioptions.statistics, GetContext::kNotFound, + Slice(key), &value, nullptr, &merge_context, env); s = table_reader->Get(read_options, key, &get_context); } else { s = db->Get(read_options, key, &result); diff --git a/util/cf_options.cc b/util/cf_options.cc index da163f0e2..c79522336 100644 --- a/util/cf_options.cc +++ b/util/cf_options.cc @@ -30,7 +30,7 @@ ImmutableCFOptions::ImmutableCFOptions(const ImmutableDBOptions& db_options, compaction_options_universal(cf_options.compaction_options_universal), compaction_options_fifo(cf_options.compaction_options_fifo), prefix_extractor(cf_options.prefix_extractor.get()), - comparator(cf_options.comparator), + user_comparator(cf_options.comparator), merge_operator(cf_options.merge_operator.get()), compaction_filter(cf_options.compaction_filter), compaction_filter_factory(cf_options.compaction_filter_factory.get()), diff --git a/util/cf_options.h b/util/cf_options.h index e3907fa0d..9e0ae4b58 100644 --- a/util/cf_options.h +++ b/util/cf_options.h @@ -34,7 +34,7 @@ struct ImmutableCFOptions { const SliceTransform* prefix_extractor; - const Comparator* comparator; + const Comparator* user_comparator; MergeOperator* merge_operator;