@ -259,8 +259,6 @@ class SpecialEnv : public EnvWrapper {
class DBTest {
class DBTest {
private :
private :
const FilterPolicy * filter_policy_ ;
const FilterPolicy * filter_policy_ ;
static std : : unique_ptr < const SliceTransform > prefix_1_transform ;
static std : : unique_ptr < const SliceTransform > noop_transform ;
protected :
protected :
// Sequence of option configurations to try
// Sequence of option configurations to try
@ -374,18 +372,18 @@ class DBTest {
Options options ;
Options options ;
switch ( option_config_ ) {
switch ( option_config_ ) {
case kHashSkipList :
case kHashSkipList :
options . memtable_factory . reset (
options . prefix_extractor . reset ( NewFixedPrefixTransform ( 1 ) ) ;
NewHashSkipListRepFactory ( NewFixedPrefixTransform ( 1 ) ) ) ;
options . memtable_factory . reset ( NewHashSkipListRepFactory ( ) ) ;
break ;
break ;
case kPlainTableFirstBytePrefix :
case kPlainTableFirstBytePrefix :
options . table_factory . reset ( new PlainTableFactory ( ) ) ;
options . table_factory . reset ( new PlainTableFactory ( ) ) ;
options . prefix_extractor = prefix_1_transform . get ( ) ;
options . prefix_extractor . reset ( NewFixedPrefixTransform ( 1 ) ) ;
options . allow_mmap_reads = true ;
options . allow_mmap_reads = true ;
options . max_sequential_skip_in_iterations = 999999 ;
options . max_sequential_skip_in_iterations = 999999 ;
break ;
break ;
case kPlainTableAllBytesPrefix :
case kPlainTableAllBytesPrefix :
options . table_factory . reset ( new PlainTableFactory ( ) ) ;
options . table_factory . reset ( new PlainTableFactory ( ) ) ;
options . prefix_extractor = noop_transform . get ( ) ;
options . prefix_extractor . reset ( NewNoopTransform ( ) ) ;
options . allow_mmap_reads = true ;
options . allow_mmap_reads = true ;
options . max_sequential_skip_in_iterations = 999999 ;
options . max_sequential_skip_in_iterations = 999999 ;
break ;
break ;
@ -425,8 +423,8 @@ class DBTest {
options . memtable_factory . reset ( new VectorRepFactory ( 100 ) ) ;
options . memtable_factory . reset ( new VectorRepFactory ( 100 ) ) ;
break ;
break ;
case kHashLinkList :
case kHashLinkList :
options . memtable_factory . reset (
options . prefix_extractor . reset ( NewFixedPrefixTransform ( 1 ) ) ;
NewHashLinkListRepFactory ( NewFixedPrefixTransform ( 1 ) , 4 ) ) ;
options . memtable_factory . reset ( NewHashLinkListRepFactory ( 4 ) ) ;
break ;
break ;
case kUniversalCompaction :
case kUniversalCompaction :
options . compaction_style = kCompactionStyleUniversal ;
options . compaction_style = kCompactionStyleUniversal ;
@ -819,10 +817,6 @@ class DBTest {
}
}
} ;
} ;
std : : unique_ptr < const SliceTransform > DBTest : : prefix_1_transform (
NewFixedPrefixTransform ( 1 ) ) ;
std : : unique_ptr < const SliceTransform > DBTest : : noop_transform (
NewNoopTransform ( ) ) ;
static std : : string Key ( int i ) {
static std : : string Key ( int i ) {
char buf [ 100 ] ;
char buf [ 100 ] ;
@ -5404,7 +5398,7 @@ TEST(DBTest, PrefixScan) {
options . env = env_ ;
options . env = env_ ;
options . no_block_cache = true ;
options . no_block_cache = true ;
options . filter_policy = NewBloomFilterPolicy ( 10 ) ;
options . filter_policy = NewBloomFilterPolicy ( 10 ) ;
options . prefix_extractor = NewFixedPrefixTransform ( 8 ) ;
options . prefix_extractor . reset ( NewFixedPrefixTransform ( 8 ) ) ;
options . whole_key_filtering = false ;
options . whole_key_filtering = false ;
options . disable_auto_compactions = true ;
options . disable_auto_compactions = true ;
options . max_background_compactions = 2 ;
options . max_background_compactions = 2 ;
@ -5412,8 +5406,7 @@ TEST(DBTest, PrefixScan) {
options . disable_seek_compaction = true ;
options . disable_seek_compaction = true ;
// Tricky: options.prefix_extractor will be released by
// Tricky: options.prefix_extractor will be released by
// NewHashSkipListRepFactory after use.
// NewHashSkipListRepFactory after use.
options . memtable_factory . reset (
options . memtable_factory . reset ( NewHashSkipListRepFactory ( ) ) ;
NewHashSkipListRepFactory ( options . prefix_extractor ) ) ;
// prefix specified, with blooms: 2 RAND I/Os
// prefix specified, with blooms: 2 RAND I/Os
// SeekToFirst
// SeekToFirst
@ -5609,14 +5602,12 @@ TEST(DBTest, TailingIteratorPrefixSeek) {
read_options . tailing = true ;
read_options . tailing = true ;
read_options . prefix_seek = true ;
read_options . prefix_seek = true ;
auto prefix_extractor = NewFixedPrefixTransform ( 2 ) ;
Options options = CurrentOptions ( ) ;
Options options = CurrentOptions ( ) ;
options . env = env_ ;
options . env = env_ ;
options . create_if_missing = true ;
options . create_if_missing = true ;
options . disable_auto_compactions = true ;
options . disable_auto_compactions = true ;
options . prefix_extractor = prefix_extractor ;
options . prefix_extractor . reset ( NewFixedPrefixTransform ( 2 ) ) ;
options . memtable_factory . reset ( NewHashSkipListRepFactory ( prefix_extractor ) ) ;
options . memtable_factory . reset ( NewHashSkipListRepFactory ( ) ) ;
DestroyAndReopen ( & options ) ;
DestroyAndReopen ( & options ) ;
std : : unique_ptr < Iterator > iter ( db_ - > NewIterator ( read_options ) ) ;
std : : unique_ptr < Iterator > iter ( db_ - > NewIterator ( read_options ) ) ;