@ -43,21 +43,23 @@ Status Configurable::PrepareOptions(const ConfigOptions& opts) {
Status status = Status : : OK ( ) ;
Status status = Status : : OK ( ) ;
# ifndef ROCKSDB_LITE
# ifndef ROCKSDB_LITE
for ( auto opt_iter : options_ ) {
for ( auto opt_iter : options_ ) {
for ( auto map_iter : * ( opt_iter . type_map ) ) {
if ( opt_iter . type_map ! = nullptr ) {
auto & opt_info = map_iter . second ;
for ( auto map_iter : * ( opt_iter . type_map ) ) {
if ( ! opt_info . IsDeprecated ( ) & & ! opt_info . IsAlias ( ) & &
auto & opt_info = map_iter . second ;
opt_info . IsConfigurable ( ) ) {
if ( ! opt_info . IsDeprecated ( ) & & ! opt_info . IsAlias ( ) & &
if ( ! opt_info . IsEnabled ( OptionTypeFlags : : kDontPrepare ) ) {
opt_info . IsConfigurable ( ) ) {
Configurable * config =
if ( ! opt_info . IsEnabled ( OptionTypeFlags : : kDontPrepare ) ) {
opt_info . AsRawPointer < Configurable > ( opt_iter . opt_ptr ) ;
Configurable * config =
if ( config ! = nullptr ) {
opt_info . AsRawPointer < Configurable > ( opt_iter . opt_ptr ) ;
status = config - > PrepareOptions ( opts ) ;
if ( config ! = nullptr ) {
if ( ! status . ok ( ) ) {
status = config - > PrepareOptions ( opts ) ;
return status ;
if ( ! status . ok ( ) ) {
return status ;
}
} else if ( ! opt_info . CanBeNull ( ) ) {
status = Status : : NotFound ( " Missing configurable object " ,
map_iter . first ) ;
}
}
} else if ( ! opt_info . CanBeNull ( ) ) {
status =
Status : : NotFound ( " Missing configurable object " , map_iter . first ) ;
}
}
}
}
}
}
@ -74,20 +76,22 @@ Status Configurable::ValidateOptions(const DBOptions& db_opts,
Status status ;
Status status ;
# ifndef ROCKSDB_LITE
# ifndef ROCKSDB_LITE
for ( auto opt_iter : options_ ) {
for ( auto opt_iter : options_ ) {
for ( auto map_iter : * ( opt_iter . type_map ) ) {
if ( opt_iter . type_map ! = nullptr ) {
auto & opt_info = map_iter . second ;
for ( auto map_iter : * ( opt_iter . type_map ) ) {
if ( ! opt_info . IsDeprecated ( ) & & ! opt_info . IsAlias ( ) ) {
auto & opt_info = map_iter . second ;
if ( opt_info . IsConfigurable ( ) ) {
if ( ! opt_info . IsDeprecated ( ) & & ! opt_info . IsAlias ( ) ) {
const Configurable * config =
if ( opt_info . IsConfigurable ( ) ) {
opt_info . AsRawPointer < Configurable > ( opt_iter . opt_ptr ) ;
const Configurable * config =
if ( config ! = nullptr ) {
opt_info . AsRawPointer < Configurable > ( opt_iter . opt_ptr ) ;
status = config - > ValidateOptions ( db_opts , cf_opts ) ;
if ( config ! = nullptr ) {
} else if ( ! opt_info . CanBeNull ( ) ) {
status = config - > ValidateOptions ( db_opts , cf_opts ) ;
status =
} else if ( ! opt_info . CanBeNull ( ) ) {
Status : : NotFound ( " Missing configurable object " , map_iter . first ) ;
status = Status : : NotFound ( " Missing configurable object " ,
}
map_iter . first ) ;
if ( ! status . ok ( ) ) {
}
return status ;
if ( ! status . ok ( ) ) {
return status ;
}
}
}
}
}
}
}
@ -124,11 +128,13 @@ const OptionTypeInfo* ConfigurableHelper::FindOption(
const std : : vector < Configurable : : RegisteredOptions > & options ,
const std : : vector < Configurable : : RegisteredOptions > & options ,
const std : : string & short_name , std : : string * opt_name , void * * opt_ptr ) {
const std : : string & short_name , std : : string * opt_name , void * * opt_ptr ) {
for ( auto iter : options ) {
for ( auto iter : options ) {
const auto opt_info =
if ( iter . type_map ! = nullptr ) {
OptionTypeInfo : : Find ( short_name , * ( iter . type_map ) , opt_name ) ;
const auto opt_info =
if ( opt_info ! = nullptr ) {
OptionTypeInfo : : Find ( short_name , * ( iter . type_map ) , opt_name ) ;
* opt_ptr = iter . opt_ptr ;
if ( opt_info ! = nullptr ) {
return opt_info ;
* opt_ptr = iter . opt_ptr ;
return opt_info ;
}
}
}
}
}
return nullptr ;
return nullptr ;
@ -280,12 +286,14 @@ Status ConfigurableHelper::ConfigureOptions(
if ( ! opts_map . empty ( ) ) {
if ( ! opts_map . empty ( ) ) {
# ifndef ROCKSDB_LITE
# ifndef ROCKSDB_LITE
for ( const auto & iter : configurable . options_ ) {
for ( const auto & iter : configurable . options_ ) {
s = ConfigureSomeOptions ( config_options , configurable , * ( iter . type_map ) ,
if ( iter . type_map ! = nullptr ) {
& remaining , iter . opt_ptr ) ;
s = ConfigureSomeOptions ( config_options , configurable , * ( iter . type_map ) ,
if ( remaining . empty ( ) ) { // Are there more options left?
& remaining , iter . opt_ptr ) ;
break ;
if ( remaining . empty ( ) ) { // Are there more options left?
} else if ( ! s . ok ( ) ) {
break ;
break ;
} else if ( ! s . ok ( ) ) {
break ;
}
}
}
}
}
# else
# else
@ -573,36 +581,38 @@ Status ConfigurableHelper::SerializeOptions(const ConfigOptions& config_options,
std : : string * result ) {
std : : string * result ) {
assert ( result ) ;
assert ( result ) ;
for ( auto const & opt_iter : configurable . options_ ) {
for ( auto const & opt_iter : configurable . options_ ) {
for ( const auto & map_iter : * ( opt_iter . type_map ) ) {
if ( opt_iter . type_map ! = nullptr ) {
const auto & opt_name = map_iter . first ;
for ( const auto & map_iter : * ( opt_iter . type_map ) ) {
const auto & opt_info = map_iter . second ;
const auto & opt_name = map_iter . first ;
if ( opt_info . ShouldSerialize ( ) ) {
const auto & opt_info = map_iter . second ;
std : : string value ;
if ( opt_info . ShouldSerialize ( ) ) {
Status s ;
std : : string value ;
if ( ! config_options . mutable_options_only ) {
Status s ;
s = opt_info . Serialize ( config_options , prefix + opt_name ,
if ( ! config_options . mutable_options_only ) {
opt_iter . opt_ptr , & value ) ;
} else if ( opt_info . IsMutable ( ) ) {
ConfigOptions copy = config_options ;
copy . mutable_options_only = false ;
s = opt_info . Serialize ( copy , prefix + opt_name , opt_iter . opt_ptr ,
& value ) ;
} else if ( opt_info . IsConfigurable ( ) ) {
// If it is a Configurable and we are either printing all of the
// details or not printing only the name, this option should be
// included in the list
if ( config_options . IsDetailed ( ) | |
! opt_info . IsEnabled ( OptionTypeFlags : : kStringNameOnly ) ) {
s = opt_info . Serialize ( config_options , prefix + opt_name ,
s = opt_info . Serialize ( config_options , prefix + opt_name ,
opt_iter . opt_ptr , & value ) ;
opt_iter . opt_ptr , & value ) ;
} else if ( opt_info . IsMutable ( ) ) {
ConfigOptions copy = config_options ;
copy . mutable_options_only = false ;
s = opt_info . Serialize ( copy , prefix + opt_name , opt_iter . opt_ptr ,
& value ) ;
} else if ( opt_info . IsConfigurable ( ) ) {
// If it is a Configurable and we are either printing all of the
// details or not printing only the name, this option should be
// included in the list
if ( config_options . IsDetailed ( ) | |
! opt_info . IsEnabled ( OptionTypeFlags : : kStringNameOnly ) ) {
s = opt_info . Serialize ( config_options , prefix + opt_name ,
opt_iter . opt_ptr , & value ) ;
}
}
if ( ! s . ok ( ) ) {
return s ;
} else if ( ! value . empty ( ) ) {
// <prefix><opt_name>=<value><delimiter>
result - > append ( prefix + opt_name + " = " + value +
config_options . delimiter ) ;
}
}
}
if ( ! s . ok ( ) ) {
return s ;
} else if ( ! value . empty ( ) ) {
// <prefix><opt_name>=<value><delimiter>
result - > append ( prefix + opt_name + " = " + value +
config_options . delimiter ) ;
}
}
}
}
}
}
@ -629,16 +639,18 @@ Status ConfigurableHelper::ListOptions(
const std : : string & prefix , std : : unordered_set < std : : string > * result ) {
const std : : string & prefix , std : : unordered_set < std : : string > * result ) {
Status status ;
Status status ;
for ( auto const & opt_iter : configurable . options_ ) {
for ( auto const & opt_iter : configurable . options_ ) {
for ( const auto & map_iter : * ( opt_iter . type_map ) ) {
if ( opt_iter . type_map ! = nullptr ) {
const auto & opt_name = map_iter . first ;
for ( const auto & map_iter : * ( opt_iter . type_map ) ) {
const auto & opt_info = map_iter . second ;
const auto & opt_name = map_iter . first ;
// If the option is no longer used in rocksdb and marked as deprecated,
const auto & opt_info = map_iter . second ;
// we skip it in the serialization.
// If the option is no longer used in rocksdb and marked as deprecated,
if ( ! opt_info . IsDeprecated ( ) & & ! opt_info . IsAlias ( ) ) {
// we skip it in the serialization.
if ( ! config_options . mutable_options_only ) {
if ( ! opt_info . IsDeprecated ( ) & & ! opt_info . IsAlias ( ) ) {
result - > emplace ( prefix + opt_name ) ;
if ( ! config_options . mutable_options_only ) {
} else if ( opt_info . IsMutable ( ) ) {
result - > emplace ( prefix + opt_name ) ;
result - > emplace ( prefix + opt_name ) ;
} else if ( opt_info . IsMutable ( ) ) {
result - > emplace ( prefix + opt_name ) ;
}
}
}
}
}
}
}
@ -702,7 +714,7 @@ bool ConfigurableHelper::AreEquivalent(const ConfigOptions& config_options,
if ( this_offset ! = that_offset ) {
if ( this_offset ! = that_offset ) {
if ( this_offset = = nullptr | | that_offset = = nullptr ) {
if ( this_offset = = nullptr | | that_offset = = nullptr ) {
return false ;
return false ;
} else {
} else if ( o . type_map ! = nullptr ) {
for ( const auto & map_iter : * ( o . type_map ) ) {
for ( const auto & map_iter : * ( o . type_map ) ) {
const auto & opt_info = map_iter . second ;
const auto & opt_info = map_iter . second ;
if ( config_options . IsCheckEnabled ( opt_info . GetSanityLevel ( ) ) ) {
if ( config_options . IsCheckEnabled ( opt_info . GetSanityLevel ( ) ) ) {