@ -38,13 +38,9 @@ namespace ROCKSDB_NAMESPACE {
// http://en.cppreference.com/w/cpp/concept/StandardLayoutType
// https://gist.github.com/graphitemaster/494f21190bb2c63c5516
# ifndef ROCKSDB_LITE
static ColumnFamily Options dummy_cf_options ;
static ImmutableCF Options dummy_cf_options ;
template < typename T1 >
int offset_of ( T1 ColumnFamilyOptions : : * member ) {
return int ( size_t ( & ( dummy_cf_options . * member ) ) - size_t ( & dummy_cf_options ) ) ;
}
template < typename T1 >
int offset_of ( T1 AdvancedColumnFamilyOptions : : * member ) {
int offset_of ( T1 ImmutableCFOptions : : * member ) {
return int ( size_t ( & ( dummy_cf_options . * member ) ) - size_t ( & dummy_cf_options ) ) ;
}
@ -492,57 +488,58 @@ static std::unordered_map<std::string, OptionTypeInfo>
{ 0 , OptionType : : kBoolean , OptionVerificationType : : kDeprecated ,
OptionTypeFlags : : kNone } } ,
{ " inplace_update_support " ,
{ offset_of ( & ColumnFamily Options: : inplace_update_support ) ,
{ offset_of ( & ImmutableCF Options: : inplace_update_support ) ,
OptionType : : kBoolean , OptionVerificationType : : kNormal ,
OptionTypeFlags : : kNone } } ,
{ " level_compaction_dynamic_level_bytes " ,
{ offset_of ( & ColumnFamily Options: : level_compaction_dynamic_level_bytes ) ,
{ offset_of ( & ImmutableCF Options: : level_compaction_dynamic_level_bytes ) ,
OptionType : : kBoolean , OptionVerificationType : : kNormal ,
OptionTypeFlags : : kNone } } ,
{ " optimize_filters_for_hits " ,
{ offset_of ( & ColumnFamily Options: : optimize_filters_for_hits ) ,
{ offset_of ( & ImmutableCF Options: : optimize_filters_for_hits ) ,
OptionType : : kBoolean , OptionVerificationType : : kNormal ,
OptionTypeFlags : : kNone } } ,
{ " force_consistency_checks " ,
{ offset_of ( & ColumnFamily Options: : force_consistency_checks ) ,
{ offset_of ( & ImmutableCF Options: : force_consistency_checks ) ,
OptionType : : kBoolean , OptionVerificationType : : kNormal ,
OptionTypeFlags : : kNone } } ,
{ " purge_redundant_kvs_while_flush " ,
{ offset_of ( & ColumnFamily Options: : purge_redundant_kvs_while_flush ) ,
{ offset_of ( & ImmutableCF Options: : purge_redundant_kvs_while_flush ) ,
OptionType : : kBoolean , OptionVerificationType : : kDeprecated ,
OptionTypeFlags : : kNone } } ,
{ " max_mem_compaction_level " ,
{ 0 , OptionType : : kInt , OptionVerificationType : : kDeprecated ,
OptionTypeFlags : : kNone } } ,
{ " max_write_buffer_number_to_maintain " ,
{ offset_of ( & ColumnFamily Options: : max_write_buffer_number_to_maintain ) ,
{ offset_of ( & ImmutableCF Options: : max_write_buffer_number_to_maintain ) ,
OptionType : : kInt , OptionVerificationType : : kNormal ,
OptionTypeFlags : : kNone , 0 } } ,
{ " max_write_buffer_size_to_maintain " ,
{ offset_of ( & ColumnFamily Options: : max_write_buffer_size_to_maintain ) ,
{ offset_of ( & ImmutableCF Options: : max_write_buffer_size_to_maintain ) ,
OptionType : : kInt64T , OptionVerificationType : : kNormal ,
OptionTypeFlags : : kNone } } ,
{ " min_write_buffer_number_to_merge " ,
{ offset_of ( & ColumnFamily Options: : min_write_buffer_number_to_merge ) ,
{ offset_of ( & ImmutableCF Options: : min_write_buffer_number_to_merge ) ,
OptionType : : kInt , OptionVerificationType : : kNormal ,
OptionTypeFlags : : kNone , 0 } } ,
{ " num_levels " ,
{ offset_of ( & ColumnFamily Options: : num_levels ) , OptionType : : kInt ,
{ offset_of ( & ImmutableCF Options: : num_levels ) , OptionType : : kInt ,
OptionVerificationType : : kNormal , OptionTypeFlags : : kNone } } ,
{ " bloom_locality " ,
{ offset_of ( & ColumnFamily Options: : bloom_locality ) , OptionType : : kUInt32T ,
{ offset_of ( & ImmutableCF Options: : bloom_locality ) , OptionType : : kUInt32T ,
OptionVerificationType : : kNormal , OptionTypeFlags : : kNone } } ,
{ " rate_limit_delay_max_milliseconds " ,
{ 0 , OptionType : : kUInt , OptionVerificationType : : kDeprecated ,
OptionTypeFlags : : kNone } } ,
{ " compression_per_level " ,
OptionTypeInfo : : Vector < CompressionType > (
offset_of ( & ColumnFamily Options: : compression_per_level ) ,
offset_of ( & ImmutableCF Options: : compression_per_level ) ,
OptionVerificationType : : kNormal , OptionTypeFlags : : kNone ,
{ 0 , OptionType : : kCompressionType } ) } ,
{ " comparator " ,
{ offset_of ( & ColumnFamilyOptions : : comparator ) , OptionType : : kComparator ,
OptionVerificationType : : kByName , OptionTypeFlags : : kCompareLoose ,
{ offset_of ( & ImmutableCFOptions : : user_comparator ) ,
OptionType : : kComparator , OptionVerificationType : : kByName ,
OptionTypeFlags : : kCompareLoose ,
// Parses the string and sets the corresponding comparator
[ ] ( const ConfigOptions & /*opts*/ , const std : : string & /*name*/ ,
const std : : string & value , char * addr ) {
@ -558,15 +555,15 @@ static std::unordered_map<std::string, OptionTypeInfo>
} } } ,
{ " memtable_insert_with_hint_prefix_extractor " ,
{ offset_of (
& ColumnFamily Options: : memtable_insert_with_hint_prefix_extractor ) ,
& ImmutableCF Options: : memtable_insert_with_hint_prefix_extractor ) ,
OptionType : : kSliceTransform , OptionVerificationType : : kByNameAllowNull ,
OptionTypeFlags : : kNone } } ,
{ " memtable_factory " ,
{ offset_of ( & ColumnFamily Options: : memtable_factory ) ,
{ offset_of ( & ImmutableCF Options: : memtable_factory ) ,
OptionType : : kMemTableRepFactory , OptionVerificationType : : kByName ,
OptionTypeFlags : : kNone } } ,
{ " memtable " ,
{ offset_of ( & ColumnFamily Options: : memtable_factory ) ,
{ offset_of ( & ImmutableCF Options: : memtable_factory ) ,
OptionType : : kMemTableRepFactory , OptionVerificationType : : kAlias ,
OptionTypeFlags : : kNone ,
// Parses the value string and updates the memtable_factory
@ -582,13 +579,13 @@ static std::unordered_map<std::string, OptionTypeInfo>
return s ;
} } } ,
{ " table_factory " , OptionTypeInfo : : AsCustomSharedPtr < TableFactory > (
offset_of ( & ColumnFamily Options: : table_factory ) ,
offset_of ( & ImmutableCF Options: : table_factory ) ,
OptionVerificationType : : kByName ,
( OptionTypeFlags : : kCompareLoose |
OptionTypeFlags : : kStringNameOnly |
OptionTypeFlags : : kDontPrepare ) ) } ,
{ " block_based_table_factory " ,
{ offset_of ( & ColumnFamily Options: : table_factory ) ,
{ offset_of ( & ImmutableCF Options: : table_factory ) ,
OptionType : : kCustomizable , OptionVerificationType : : kAlias ,
OptionTypeFlags : : kShared | OptionTypeFlags : : kCompareLoose ,
// Parses the input value and creates a BlockBasedTableFactory
@ -620,7 +617,7 @@ static std::unordered_map<std::string, OptionTypeInfo>
}
} } } ,
{ " plain_table_factory " ,
{ offset_of ( & ColumnFamily Options: : table_factory ) ,
{ offset_of ( & ImmutableCF Options: : table_factory ) ,
OptionType : : kCustomizable , OptionVerificationType : : kAlias ,
OptionTypeFlags : : kShared | OptionTypeFlags : : kCompareLoose ,
// Parses the input value and creates a PlainTableFactory
@ -651,15 +648,15 @@ static std::unordered_map<std::string, OptionTypeInfo>
}
} } } ,
{ " compaction_filter " ,
{ offset_of ( & ColumnFamily Options: : compaction_filter ) ,
{ offset_of ( & ImmutableCF Options: : compaction_filter ) ,
OptionType : : kCompactionFilter , OptionVerificationType : : kByName ,
OptionTypeFlags : : kNone } } ,
{ " compaction_filter_factory " ,
{ offset_of ( & ColumnFamily Options: : compaction_filter_factory ) ,
{ offset_of ( & ImmutableCF Options: : compaction_filter_factory ) ,
OptionType : : kCompactionFilterFactory , OptionVerificationType : : kByName ,
OptionTypeFlags : : kNone } } ,
{ " merge_operator " ,
{ offset_of ( & ColumnFamily Options: : merge_operator ) ,
{ offset_of ( & ImmutableCF Options: : merge_operator ) ,
OptionType : : kMergeOperator ,
OptionVerificationType : : kByNameAllowFromNull ,
OptionTypeFlags : : kCompareLoose ,
@ -677,11 +674,11 @@ static std::unordered_map<std::string, OptionTypeInfo>
return Status : : OK ( ) ;
} } } ,
{ " compaction_style " ,
{ offset_of ( & ColumnFamily Options: : compaction_style ) ,
{ offset_of ( & ImmutableCF Options: : compaction_style ) ,
OptionType : : kCompactionStyle , OptionVerificationType : : kNormal ,
OptionTypeFlags : : kNone } } ,
{ " compaction_pri " ,
{ offset_of ( & ColumnFamily Options: : compaction_pri ) ,
{ offset_of ( & ImmutableCF Options: : compaction_pri ) ,
OptionType : : kCompactionPri , OptionVerificationType : : kNormal ,
OptionTypeFlags : : kNone } } ,
} ;
@ -705,11 +702,10 @@ class ConfigurableCFOptions : public ConfigurableMutableCFOptions {
ConfigurableCFOptions ( const ColumnFamilyOptions & opts ,
const std : : unordered_map < std : : string , std : : string > * map )
: ConfigurableMutableCFOptions ( MutableCFOptions ( opts ) ) ,
immutable_ ( opts ) ,
immutable_ ( ImmutableDBOptions ( ) , opts ) ,
cf_options_ ( opts ) ,
opt_map_ ( map ) {
ConfigurableHelper : : RegisterOptions ( * this , OptionsHelper : : kCFOptionsName ,
& immutable_ ,
ConfigurableHelper : : RegisterOptions ( * this , & immutable_ ,
& cf_immutable_options_type_info ) ;
}
@ -774,7 +770,7 @@ class ConfigurableCFOptions : public ConfigurableMutableCFOptions {
}
private :
ColumnFamily Options immutable_ ;
ImmutableCF Options immutable_ ;
ColumnFamilyOptions cf_options_ ;
const std : : unordered_map < std : : string , std : : string > * opt_map_ ;
} ;
@ -792,18 +788,22 @@ std::unique_ptr<Configurable> CFOptionsAsConfigurable(
}
# endif // ROCKSDB_LITE
ImmutableCFOptions : : ImmutableCFOptions ( ) : ImmutableCFOptions ( Options ( ) ) { }
ImmutableCFOptions : : ImmutableCFOptions ( const Options & options )
: ImmutableCFOptions ( ImmutableDBOptions ( options ) , options ) { }
ImmutableCFOptions : : ImmutableCFOptions ( const ImmutableDBOptions & db_options ,
const ColumnFamilyOptions & cf_options )
: compaction_style ( cf_options . compaction_style ) ,
: logger ( db_options . info_log ) ,
stats ( db_options . statistics ) ,
compaction_style ( cf_options . compaction_style ) ,
compaction_pri ( cf_options . compaction_pri ) ,
user_comparator ( cf_options . comparator ) ,
internal_comparator ( InternalKeyComparator ( cf_options . comparator ) ) ,
merge_operator ( cf_options . merge_operator . get ( ) ) ,
merge_operator ( cf_options . merge_operator ) ,
compaction_filter ( cf_options . compaction_filter ) ,
compaction_filter_factory ( cf_options . compaction_filter_factory . get ( ) ) ,
compaction_filter_factory ( cf_options . compaction_filter_factory ) ,
min_write_buffer_number_to_merge (
cf_options . min_write_buffer_number_to_merge ) ,
max_write_buffer_number_to_maintain (
@ -812,9 +812,9 @@ ImmutableCFOptions::ImmutableCFOptions(const ImmutableDBOptions& db_options,
cf_options . max_write_buffer_size_to_maintain ) ,
inplace_update_support ( cf_options . inplace_update_support ) ,
inplace_callback ( cf_options . inplace_callback ) ,
info_log ( db_options . info_log . get ( ) ) ,
statistics ( db_options . statistic s . get ( ) ) ,
rate_limiter ( db_options . rate_limiter . get ( ) ) ,
info_log ( logger . get ( ) ) ,
statistics ( stats . get ( ) ) ,
rate_limiter ( db_options . rate_limiter ) ,
info_log_level ( db_options . info_log_level ) ,
env ( db_options . env ) ,
fs ( db_options . fs . get ( ) ) ,
@ -822,8 +822,8 @@ ImmutableCFOptions::ImmutableCFOptions(const ImmutableDBOptions& db_options,
allow_mmap_reads ( db_options . allow_mmap_reads ) ,
allow_mmap_writes ( db_options . allow_mmap_writes ) ,
db_paths ( db_options . db_paths ) ,
memtable_factory ( cf_options . memtable_factory . get ( ) ) ,
table_factory ( cf_options . table_factory . get ( ) ) ,
memtable_factory ( cf_options . memtable_factory ) ,
table_factory ( cf_options . table_factory ) ,
table_properties_collector_factories (
cf_options . table_properties_collector_factories ) ,
advise_random_on_open ( db_options . advise_random_on_open ) ,
@ -846,10 +846,10 @@ ImmutableCFOptions::ImmutableCFOptions(const ImmutableDBOptions& db_options,
listeners ( db_options . listeners ) ,
row_cache ( db_options . row_cache ) ,
memtable_insert_with_hint_prefix_extractor (
cf_options . memtable_insert_with_hint_prefix_extractor . get ( ) ) ,
cf_options . memtable_insert_with_hint_prefix_extractor ) ,
cf_paths ( cf_options . cf_paths ) ,
compaction_thread_limiter ( cf_options . compaction_thread_limiter ) ,
file_checksum_gen_factory ( db_options . file_checksum_gen_factory . get ( ) ) ,
file_checksum_gen_factory ( db_options . file_checksum_gen_factory ) ,
sst_partitioner_factory ( cf_options . sst_partitioner_factory ) ,
allow_data_in_errors ( db_options . allow_data_in_errors ) ,
db_host_id ( db_options . db_host_id ) ,