@ -16,14 +16,8 @@
# include <inttypes.h>
# include "rocksdb/cache.h"
# include "rocksdb/compaction_filter.h"
# include "rocksdb/convenience.h"
# include "rocksdb/merge_operator.h"
# include "rocksdb/options.h"
# include "rocksdb/table.h"
# include "rocksdb/utilities/leveldb_options.h"
# include "table/block_based_table_factory.h"
# include "table/plain_table_factory.h"
# include "util/options_helper.h"
# include "util/options_parser.h"
# include "util/options_sanity_check.h"
@ -75,163 +69,6 @@ Options PrintAndGetOptions(size_t total_write_buffer_limit,
return options ;
}
class StringEnv : public EnvWrapper {
public :
class SeqStringSource : public SequentialFile {
public :
explicit SeqStringSource ( const std : : string & data )
: data_ ( data ) , offset_ ( 0 ) { }
~ SeqStringSource ( ) { }
Status Read ( size_t n , Slice * result , char * scratch ) override {
std : : string output ;
if ( offset_ < data_ . size ( ) ) {
n = std : : min ( data_ . size ( ) - offset_ , n ) ;
memcpy ( scratch , data_ . data ( ) + offset_ , n ) ;
offset_ + = n ;
* result = Slice ( scratch , n ) ;
} else {
return Status : : InvalidArgument (
" Attemp to read when it already reached eof. " ) ;
}
return Status : : OK ( ) ;
}
Status Skip ( uint64_t n ) override {
if ( offset_ > = data_ . size ( ) ) {
return Status : : InvalidArgument (
" Attemp to read when it already reached eof. " ) ;
}
// TODO(yhchiang): Currently doesn't handle the overflow case.
offset_ + = n ;
return Status : : OK ( ) ;
}
private :
std : : string data_ ;
size_t offset_ ;
} ;
class StringSink : public WritableFile {
public :
explicit StringSink ( std : : string * contents )
: WritableFile ( ) , contents_ ( contents ) { }
virtual Status Truncate ( uint64_t size ) override {
contents_ - > resize ( size ) ;
return Status : : OK ( ) ;
}
virtual Status Close ( ) override { return Status : : OK ( ) ; }
virtual Status Flush ( ) override { return Status : : OK ( ) ; }
virtual Status Sync ( ) override { return Status : : OK ( ) ; }
virtual Status Append ( const Slice & slice ) override {
contents_ - > append ( slice . data ( ) , slice . size ( ) ) ;
return Status : : OK ( ) ;
}
private :
std : : string * contents_ ;
} ;
explicit StringEnv ( Env * t ) : EnvWrapper ( t ) { }
virtual ~ StringEnv ( ) { }
const std : : string & GetContent ( const std : : string & f ) { return files_ [ f ] ; }
const Status WriteToNewFile ( const std : : string & file_name ,
const std : : string & content ) {
unique_ptr < WritableFile > r ;
auto s = NewWritableFile ( file_name , & r , EnvOptions ( ) ) ;
if ( ! s . ok ( ) ) {
return s ;
}
r - > Append ( content ) ;
r - > Flush ( ) ;
r - > Close ( ) ;
assert ( files_ [ file_name ] = = content ) ;
return Status : : OK ( ) ;
}
// The following text is boilerplate that forwards all methods to target()
Status NewSequentialFile ( const std : : string & f , unique_ptr < SequentialFile > * r ,
const EnvOptions & options ) override {
auto iter = files_ . find ( f ) ;
if ( iter = = files_ . end ( ) ) {
return Status : : NotFound ( " The specified file does not exist " , f ) ;
}
r - > reset ( new SeqStringSource ( iter - > second ) ) ;
return Status : : OK ( ) ;
}
Status NewRandomAccessFile ( const std : : string & f ,
unique_ptr < RandomAccessFile > * r ,
const EnvOptions & options ) override {
return Status : : NotSupported ( ) ;
}
Status NewWritableFile ( const std : : string & f , unique_ptr < WritableFile > * r ,
const EnvOptions & options ) override {
auto iter = files_ . find ( f ) ;
if ( iter ! = files_ . end ( ) ) {
return Status : : IOError ( " The specified file already exists " , f ) ;
}
r - > reset ( new StringSink ( & files_ [ f ] ) ) ;
return Status : : OK ( ) ;
}
virtual Status NewDirectory ( const std : : string & name ,
unique_ptr < Directory > * result ) override {
return Status : : NotSupported ( ) ;
}
Status FileExists ( const std : : string & f ) override {
if ( files_ . find ( f ) = = files_ . end ( ) ) {
return Status : : NotFound ( ) ;
}
return Status : : OK ( ) ;
}
Status GetChildren ( const std : : string & dir ,
std : : vector < std : : string > * r ) override {
return Status : : NotSupported ( ) ;
}
Status DeleteFile ( const std : : string & f ) override {
files_ . erase ( f ) ;
return Status : : OK ( ) ;
}
Status CreateDir ( const std : : string & d ) override {
return Status : : NotSupported ( ) ;
}
Status CreateDirIfMissing ( const std : : string & d ) override {
return Status : : NotSupported ( ) ;
}
Status DeleteDir ( const std : : string & d ) override {
return Status : : NotSupported ( ) ;
}
Status GetFileSize ( const std : : string & f , uint64_t * s ) override {
auto iter = files_ . find ( f ) ;
if ( iter = = files_ . end ( ) ) {
return Status : : NotFound ( " The specified file does not exist: " , f ) ;
}
* s = iter - > second . size ( ) ;
return Status : : OK ( ) ;
}
Status GetFileModificationTime ( const std : : string & fname ,
uint64_t * file_mtime ) override {
return Status : : NotSupported ( ) ;
}
Status RenameFile ( const std : : string & s , const std : : string & t ) override {
return Status : : NotSupported ( ) ;
}
Status LinkFile ( const std : : string & s , const std : : string & t ) override {
return Status : : NotSupported ( ) ;
}
Status LockFile ( const std : : string & f , FileLock * * l ) override {
return Status : : NotSupported ( ) ;
}
Status UnlockFile ( FileLock * l ) override { return Status : : NotSupported ( ) ; }
protected :
std : : unordered_map < std : : string , std : : string > files_ ;
} ;
class OptionsTest : public testing : : Test { } ;
TEST_F ( OptionsTest , LooseCondition ) {
@ -736,70 +573,12 @@ TEST_F(OptionsTest, GetOptionsFromStringTest) {
ASSERT_TRUE ( new_options . rate_limiter . get ( ) ! = nullptr ) ;
}
namespace {
void RandomInitDBOptions ( DBOptions * db_opt , Random * rnd ) {
// boolean options
db_opt - > advise_random_on_open = rnd - > Uniform ( 2 ) ;
db_opt - > allow_mmap_reads = rnd - > Uniform ( 2 ) ;
db_opt - > allow_mmap_writes = rnd - > Uniform ( 2 ) ;
db_opt - > allow_os_buffer = rnd - > Uniform ( 2 ) ;
db_opt - > create_if_missing = rnd - > Uniform ( 2 ) ;
db_opt - > create_missing_column_families = rnd - > Uniform ( 2 ) ;
db_opt - > disableDataSync = rnd - > Uniform ( 2 ) ;
db_opt - > enable_thread_tracking = rnd - > Uniform ( 2 ) ;
db_opt - > error_if_exists = rnd - > Uniform ( 2 ) ;
db_opt - > is_fd_close_on_exec = rnd - > Uniform ( 2 ) ;
db_opt - > paranoid_checks = rnd - > Uniform ( 2 ) ;
db_opt - > skip_log_error_on_recovery = rnd - > Uniform ( 2 ) ;
db_opt - > skip_stats_update_on_db_open = rnd - > Uniform ( 2 ) ;
db_opt - > use_adaptive_mutex = rnd - > Uniform ( 2 ) ;
db_opt - > use_fsync = rnd - > Uniform ( 2 ) ;
db_opt - > recycle_log_file_num = rnd - > Uniform ( 2 ) ;
// int options
db_opt - > max_background_compactions = rnd - > Uniform ( 100 ) ;
db_opt - > max_background_flushes = rnd - > Uniform ( 100 ) ;
db_opt - > max_file_opening_threads = rnd - > Uniform ( 100 ) ;
db_opt - > max_open_files = rnd - > Uniform ( 100 ) ;
db_opt - > table_cache_numshardbits = rnd - > Uniform ( 100 ) ;
// size_t options
db_opt - > db_write_buffer_size = rnd - > Uniform ( 10000 ) ;
db_opt - > keep_log_file_num = rnd - > Uniform ( 10000 ) ;
db_opt - > log_file_time_to_roll = rnd - > Uniform ( 10000 ) ;
db_opt - > manifest_preallocation_size = rnd - > Uniform ( 10000 ) ;
db_opt - > max_log_file_size = rnd - > Uniform ( 10000 ) ;
// std::string options
db_opt - > db_log_dir = " path/to/db_log_dir " ;
db_opt - > wal_dir = " path/to/wal_dir " ;
// uint32_t options
db_opt - > max_subcompactions = rnd - > Uniform ( 100000 ) ;
// uint64_t options
static const uint64_t uint_max = static_cast < uint64_t > ( UINT_MAX ) ;
db_opt - > WAL_size_limit_MB = uint_max + rnd - > Uniform ( 100000 ) ;
db_opt - > WAL_ttl_seconds = uint_max + rnd - > Uniform ( 100000 ) ;
db_opt - > bytes_per_sync = uint_max + rnd - > Uniform ( 100000 ) ;
db_opt - > delayed_write_rate = uint_max + rnd - > Uniform ( 100000 ) ;
db_opt - > delete_obsolete_files_period_micros = uint_max + rnd - > Uniform ( 100000 ) ;
db_opt - > max_manifest_file_size = uint_max + rnd - > Uniform ( 100000 ) ;
db_opt - > max_total_wal_size = uint_max + rnd - > Uniform ( 100000 ) ;
db_opt - > wal_bytes_per_sync = uint_max + rnd - > Uniform ( 100000 ) ;
// unsigned int options
db_opt - > stats_dump_period_sec = rnd - > Uniform ( 100000 ) ;
}
} // namespace
TEST_F ( OptionsTest , DBOptionsSerialization ) {
Options base_options , new_options ;
Random rnd ( 301 ) ;
// Phase 1: Make big change in base_options
RandomInitDBOptions ( & base_options , & rnd ) ;
test : : RandomInitDBOptions ( & base_options , & rnd ) ;
// Phase 2: obtain a string from base_option
std : : string base_options_file_content ;
@ -812,212 +591,12 @@ TEST_F(OptionsTest, DBOptionsSerialization) {
ASSERT_OK ( RocksDBOptionsParser : : VerifyDBOptions ( base_options , new_options ) ) ;
}
namespace {
CompressionType RandomCompressionType ( Random * rnd ) {
return static_cast < CompressionType > ( rnd - > Uniform ( 6 ) ) ;
}
void RandomCompressionTypeVector ( const size_t count ,
std : : vector < CompressionType > * types ,
Random * rnd ) {
types - > clear ( ) ;
for ( size_t i = 0 ; i < count ; + + i ) {
types - > emplace_back ( RandomCompressionType ( rnd ) ) ;
}
}
const SliceTransform * RandomSliceTransform ( Random * rnd , int pre_defined = - 1 ) {
int random_num = pre_defined > = 0 ? pre_defined : rnd - > Uniform ( 4 ) ;
switch ( random_num ) {
case 0 :
return NewFixedPrefixTransform ( rnd - > Uniform ( 20 ) + 1 ) ;
case 1 :
return NewCappedPrefixTransform ( rnd - > Uniform ( 20 ) + 1 ) ;
case 2 :
return NewNoopTransform ( ) ;
default :
return nullptr ;
}
}
TableFactory * RandomTableFactory ( Random * rnd , int pre_defined = - 1 ) {
int random_num = pre_defined > = 0 ? pre_defined : rnd - > Uniform ( 3 ) ;
switch ( random_num ) {
case 0 :
return NewPlainTableFactory ( ) ;
case 1 :
return NewCuckooTableFactory ( ) ;
default :
return NewBlockBasedTableFactory ( ) ;
}
}
std : : string RandomString ( Random * rnd , const size_t len ) {
std : : stringstream ss ;
for ( size_t i = 0 ; i < len ; + + i ) {
ss < < static_cast < char > ( rnd - > Uniform ( 26 ) + ' a ' ) ;
}
return ss . str ( ) ;
}
class ChanglingMergeOperator : public MergeOperator {
public :
explicit ChanglingMergeOperator ( const std : : string & name )
: name_ ( name + " MergeOperator " ) { }
~ ChanglingMergeOperator ( ) { }
void SetName ( const std : : string & name ) { name_ = name ; }
virtual bool FullMerge ( const Slice & key , const Slice * existing_value ,
const std : : deque < std : : string > & operand_list ,
std : : string * new_value ,
Logger * logger ) const override {
return false ;
}
virtual bool PartialMergeMulti ( const Slice & key ,
const std : : deque < Slice > & operand_list ,
std : : string * new_value ,
Logger * logger ) const override {
return false ;
}
virtual const char * Name ( ) const override { return name_ . c_str ( ) ; }
protected :
std : : string name_ ;
} ;
MergeOperator * RandomMergeOperator ( Random * rnd ) {
return new ChanglingMergeOperator ( RandomString ( rnd , 10 ) ) ;
}
class ChanglingCompactionFilter : public CompactionFilter {
public :
explicit ChanglingCompactionFilter ( const std : : string & name )
: name_ ( name + " CompactionFilter " ) { }
~ ChanglingCompactionFilter ( ) { }
void SetName ( const std : : string & name ) { name_ = name ; }
bool Filter ( int level , const Slice & key , const Slice & existing_value ,
std : : string * new_value , bool * value_changed ) const override {
return false ;
}
const char * Name ( ) const override { return name_ . c_str ( ) ; }
private :
std : : string name_ ;
} ;
CompactionFilter * RandomCompactionFilter ( Random * rnd ) {
return new ChanglingCompactionFilter ( RandomString ( rnd , 10 ) ) ;
}
class ChanglingCompactionFilterFactory : public CompactionFilterFactory {
public :
explicit ChanglingCompactionFilterFactory ( const std : : string & name )
: name_ ( name + " CompactionFilterFactory " ) { }
~ ChanglingCompactionFilterFactory ( ) { }
void SetName ( const std : : string & name ) { name_ = name ; }
std : : unique_ptr < CompactionFilter > CreateCompactionFilter (
const CompactionFilter : : Context & context ) override {
return std : : unique_ptr < CompactionFilter > ( ) ;
}
// Returns a name that identifies this compaction filter factory.
const char * Name ( ) const override { return name_ . c_str ( ) ; }
protected :
std : : string name_ ;
} ;
CompactionFilterFactory * RandomCompactionFilterFactory ( Random * rnd ) {
return new ChanglingCompactionFilterFactory ( RandomString ( rnd , 10 ) ) ;
}
// Note that the caller is responsible for releasing non-null
// cf_opt->compaction_filter.
void RandomInitCFOptions ( ColumnFamilyOptions * cf_opt , Random * rnd ) {
cf_opt - > compaction_style = ( CompactionStyle ) ( rnd - > Uniform ( 4 ) ) ;
// boolean options
cf_opt - > compaction_measure_io_stats = rnd - > Uniform ( 2 ) ;
cf_opt - > disable_auto_compactions = rnd - > Uniform ( 2 ) ;
cf_opt - > filter_deletes = rnd - > Uniform ( 2 ) ;
cf_opt - > inplace_update_support = rnd - > Uniform ( 2 ) ;
cf_opt - > level_compaction_dynamic_level_bytes = rnd - > Uniform ( 2 ) ;
cf_opt - > optimize_filters_for_hits = rnd - > Uniform ( 2 ) ;
cf_opt - > paranoid_file_checks = rnd - > Uniform ( 2 ) ;
cf_opt - > purge_redundant_kvs_while_flush = rnd - > Uniform ( 2 ) ;
cf_opt - > verify_checksums_in_compaction = rnd - > Uniform ( 2 ) ;
// double options
cf_opt - > hard_rate_limit = static_cast < double > ( rnd - > Uniform ( 10000 ) ) / 13 ;
cf_opt - > soft_rate_limit = static_cast < double > ( rnd - > Uniform ( 10000 ) ) / 13 ;
// int options
cf_opt - > expanded_compaction_factor = rnd - > Uniform ( 100 ) ;
cf_opt - > level0_file_num_compaction_trigger = rnd - > Uniform ( 100 ) ;
cf_opt - > level0_slowdown_writes_trigger = rnd - > Uniform ( 100 ) ;
cf_opt - > level0_stop_writes_trigger = rnd - > Uniform ( 100 ) ;
cf_opt - > max_bytes_for_level_multiplier = rnd - > Uniform ( 100 ) ;
cf_opt - > max_grandparent_overlap_factor = rnd - > Uniform ( 100 ) ;
cf_opt - > max_mem_compaction_level = rnd - > Uniform ( 100 ) ;
cf_opt - > max_write_buffer_number = rnd - > Uniform ( 100 ) ;
cf_opt - > max_write_buffer_number_to_maintain = rnd - > Uniform ( 100 ) ;
cf_opt - > min_write_buffer_number_to_merge = rnd - > Uniform ( 100 ) ;
cf_opt - > num_levels = rnd - > Uniform ( 100 ) ;
cf_opt - > source_compaction_factor = rnd - > Uniform ( 100 ) ;
cf_opt - > target_file_size_multiplier = rnd - > Uniform ( 100 ) ;
// size_t options
cf_opt - > arena_block_size = rnd - > Uniform ( 10000 ) ;
cf_opt - > inplace_update_num_locks = rnd - > Uniform ( 10000 ) ;
cf_opt - > max_successive_merges = rnd - > Uniform ( 10000 ) ;
cf_opt - > memtable_prefix_bloom_huge_page_tlb_size = rnd - > Uniform ( 10000 ) ;
cf_opt - > write_buffer_size = rnd - > Uniform ( 10000 ) ;
// uint32_t options
cf_opt - > bloom_locality = rnd - > Uniform ( 10000 ) ;
cf_opt - > memtable_prefix_bloom_bits = rnd - > Uniform ( 10000 ) ;
cf_opt - > memtable_prefix_bloom_probes = rnd - > Uniform ( 10000 ) ;
cf_opt - > min_partial_merge_operands = rnd - > Uniform ( 10000 ) ;
cf_opt - > max_bytes_for_level_base = rnd - > Uniform ( 10000 ) ;
// uint64_t options
static const uint64_t uint_max = static_cast < uint64_t > ( UINT_MAX ) ;
cf_opt - > max_sequential_skip_in_iterations = uint_max + rnd - > Uniform ( 10000 ) ;
cf_opt - > target_file_size_base = uint_max + rnd - > Uniform ( 10000 ) ;
// unsigned int options
cf_opt - > rate_limit_delay_max_milliseconds = rnd - > Uniform ( 10000 ) ;
// pointer typed options
cf_opt - > prefix_extractor . reset ( RandomSliceTransform ( rnd ) ) ;
cf_opt - > table_factory . reset ( RandomTableFactory ( rnd ) ) ;
cf_opt - > merge_operator . reset ( RandomMergeOperator ( rnd ) ) ;
if ( cf_opt - > compaction_filter ) {
delete cf_opt - > compaction_filter ;
}
cf_opt - > compaction_filter = RandomCompactionFilter ( rnd ) ;
cf_opt - > compaction_filter_factory . reset ( RandomCompactionFilterFactory ( rnd ) ) ;
// custom typed options
cf_opt - > compression = RandomCompressionType ( rnd ) ;
RandomCompressionTypeVector ( cf_opt - > num_levels ,
& cf_opt - > compression_per_level , rnd ) ;
}
} // namespace
TEST_F ( OptionsTest , ColumnFamilyOptionsSerialization ) {
ColumnFamilyOptions base_opt , new_opt ;
Random rnd ( 302 ) ;
// Phase 1: randomly assign base_opt
// custom type options
RandomInitCFOptions ( & base_opt , & rnd ) ;
test : : RandomInitCFOptions ( & base_opt , & rnd ) ;
// Phase 2: obtain a string from base_opt
std : : string base_options_file_content ;
@ -1036,7 +615,6 @@ TEST_F(OptionsTest, ColumnFamilyOptionsSerialization) {
# endif // !ROCKSDB_LITE
Status StringToMap (
const std : : string & opts_str ,
std : : unordered_map < std : : string , std : : string > * opts_map ) ;
@ -1238,10 +816,10 @@ TEST_F(OptionsTest, ConvertOptionsTest) {
# ifndef ROCKSDB_LITE
class OptionsParserTest : public testing : : Test {
public :
OptionsParserTest ( ) { env_ . reset ( new StringEnv ( Env : : Default ( ) ) ) ; }
OptionsParserTest ( ) { env_ . reset ( new test : : StringEnv ( Env : : Default ( ) ) ) ; }
protected :
std : : unique_ptr < StringEnv > env_ ;
std : : unique_ptr < test : : StringEnv > env_ ;
} ;
TEST_F ( OptionsParserTest , Comment ) {
@ -1485,7 +1063,7 @@ void VerifyCFPointerTypedOptions(
// change the name of merge operator back-and-forth
{
auto * merge_operator = dynamic_cast < ChanglingMergeOperator * > (
auto * merge_operator = dynamic_cast < test : : ChanglingMergeOperator * > (
base_cf_opt - > merge_operator . get ( ) ) ;
if ( merge_operator ! = nullptr ) {
name_buffer = merge_operator - > Name ( ) ;
@ -1503,7 +1081,7 @@ void VerifyCFPointerTypedOptions(
// change the name of the compaction filter factory back-and-forth
{
auto * compaction_filter_factory =
dynamic_cast < ChanglingCompactionFilterFactory * > (
dynamic_cast < test : : ChanglingCompactionFilterFactory * > (
base_cf_opt - > compaction_filter_factory . get ( ) ) ;
if ( compaction_filter_factory ! = nullptr ) {
name_buffer = compaction_filter_factory - > Name ( ) ;
@ -1573,17 +1151,17 @@ TEST_F(OptionsParserTest, DumpAndParse) {
" ###rocksdb#1-testcf#2### " } ;
const int num_cf = static_cast < int > ( cf_names . size ( ) ) ;
Random rnd ( 302 ) ;
RandomInitDBOptions ( & base_db_opt , & rnd ) ;
test : : RandomInitDBOptions ( & base_db_opt , & rnd ) ;
base_db_opt . db_log_dir + = " /#odd #but #could #happen #path #/ \\ \\ #OMG " ;
for ( int c = 0 ; c < num_cf ; + + c ) {
ColumnFamilyOptions cf_opt ;
Random cf_rnd ( 0xFB + c ) ;
RandomInitCFOptions ( & cf_opt , & cf_rnd ) ;
test : : RandomInitCFOptions ( & cf_opt , & cf_rnd ) ;
if ( c < 4 ) {
cf_opt . prefix_extractor . reset ( RandomSliceTransform ( & rnd , c ) ) ;
cf_opt . prefix_extractor . reset ( test : : RandomSliceTransform ( & rnd , c ) ) ;
}
if ( c < 3 ) {
cf_opt . table_factory . reset ( RandomTableFactory ( & rnd , c ) ) ;
cf_opt . table_factory . reset ( test : : RandomTableFactory ( & rnd , c ) ) ;
}
base_cf_opts . emplace_back ( cf_opt ) ;
}
@ -1717,7 +1295,7 @@ TEST_F(OptionsSanityCheckTest, SanityCheck) {
{
for ( int tb = 2 ; tb > = 0 ; - - tb ) {
// change the table factory
opts . table_factory . reset ( RandomTableFactory ( & rnd , tb ) ) ;
opts . table_factory . reset ( test : : RandomTableFactory ( & rnd , tb ) ) ;
ASSERT_NOK ( SanityCheckCFOptions ( opts , kSanityLevelLooselyCompatible ) ) ;
ASSERT_OK ( SanityCheckCFOptions ( opts , kSanityLevelNone ) ) ;
@ -1731,7 +1309,7 @@ TEST_F(OptionsSanityCheckTest, SanityCheck) {
{
for ( int test = 0 ; test < 5 ; + + test ) {
// change the merge operator
opts . merge_operator . reset ( RandomMergeOperator ( & rnd ) ) ;
opts . merge_operator . reset ( test : : RandomMergeOperator ( & rnd ) ) ;
ASSERT_NOK ( SanityCheckCFOptions ( opts , kSanityLevelLooselyCompatible ) ) ;
ASSERT_OK ( SanityCheckCFOptions ( opts , kSanityLevelNone ) ) ;
@ -1745,7 +1323,7 @@ TEST_F(OptionsSanityCheckTest, SanityCheck) {
{
for ( int test = 0 ; test < 5 ; + + test ) {
// change the compaction filter
opts . compaction_filter = RandomCompactionFilter ( & rnd ) ;
opts . compaction_filter = test : : RandomCompactionFilter ( & rnd ) ;
ASSERT_NOK ( SanityCheckCFOptions ( opts , kSanityLevelExactMatch ) ) ;
ASSERT_OK ( SanityCheckCFOptions ( opts , kSanityLevelLooselyCompatible ) ) ;
@ -1761,7 +1339,8 @@ TEST_F(OptionsSanityCheckTest, SanityCheck) {
{
for ( int test = 0 ; test < 5 ; + + test ) {
// change the compaction filter factory
opts . compaction_filter_factory . reset ( RandomCompactionFilterFactory ( & rnd ) ) ;
opts . compaction_filter_factory . reset (
test : : RandomCompactionFilterFactory ( & rnd ) ) ;
ASSERT_NOK ( SanityCheckCFOptions ( opts , kSanityLevelExactMatch ) ) ;
ASSERT_OK ( SanityCheckCFOptions ( opts , kSanityLevelLooselyCompatible ) ) ;