@ -234,7 +234,7 @@ class DBIteratorTest : public testing::Test {
TEST_F ( DBIteratorTest , DBIteratorPrevNext ) {
Options options ;
ImmutableCFOptions cf_options = ImmutableCFOptions ( options ) ;
MutableCFOptions mutable_cf_options = MutableCFOptions ( options ) ;
{
TestIterator * internal_iter = new TestIterator ( BytewiseComparator ( ) ) ;
internal_iter - > AddDeletion ( " a " ) ;
@ -248,8 +248,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
ReadOptions ro ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 10 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -280,8 +281,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
ReadOptions ro ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 10 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -306,8 +308,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
ro . iterate_upper_bound = & prefix ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 10 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -338,8 +341,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
ro . iterate_upper_bound = & prefix ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 10 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -373,8 +377,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
ro . iterate_upper_bound = & prefix ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 10 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( ! db_iter - > Valid ( ) ) ;
@ -402,8 +407,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
ro . iterate_upper_bound = & prefix ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 7 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 7 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
SetPerfLevel ( kEnableCount ) ;
ASSERT_TRUE ( GetPerfLevel ( ) = = kEnableCount ) ;
@ -439,8 +445,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
ro . iterate_upper_bound = & prefix ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 4 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 4 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -464,8 +471,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
ro . iterate_upper_bound = & prefix ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 10 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( ! db_iter - > Valid ( ) ) ;
@ -486,8 +494,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
ro . iterate_upper_bound = & prefix ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 10 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -521,8 +530,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
ro . iterate_upper_bound = & prefix ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 7 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 7 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
SetPerfLevel ( kEnableCount ) ;
ASSERT_TRUE ( GetPerfLevel ( ) = = kEnableCount ) ;
@ -550,8 +560,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
ReadOptions ro ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 10 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -592,8 +603,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
ReadOptions ro ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 2 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 2 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " b " ) ;
@ -623,8 +635,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
ReadOptions ro ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 10 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " c " ) ;
@ -645,6 +658,7 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
TEST_F ( DBIteratorTest , DBIteratorEmpty ) {
Options options ;
ImmutableCFOptions cf_options = ImmutableCFOptions ( options ) ;
MutableCFOptions mutable_cf_options = MutableCFOptions ( options ) ;
ReadOptions ro ;
{
@ -652,8 +666,9 @@ TEST_F(DBIteratorTest, DBIteratorEmpty) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 0 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 0 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( ! db_iter - > Valid ( ) ) ;
}
@ -663,8 +678,9 @@ TEST_F(DBIteratorTest, DBIteratorEmpty) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 0 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 0 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( ! db_iter - > Valid ( ) ) ;
}
@ -684,10 +700,10 @@ TEST_F(DBIteratorTest, DBIteratorUseSkipCountSkips) {
}
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
NewDBIterator ( env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 2 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , ImmutableCFOptions ( options ) , MutableCFOptions ( options ) ,
BytewiseComparator ( ) , internal_iter , 2 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " c " ) ;
@ -716,6 +732,7 @@ TEST_F(DBIteratorTest, DBIteratorUseSkip) {
Options options ;
options . merge_operator = MergeOperators : : CreateFromStringId ( " stringappend " ) ;
ImmutableCFOptions cf_options = ImmutableCFOptions ( options ) ;
MutableCFOptions mutable_cf_options = MutableCFOptions ( options ) ;
{
for ( size_t i = 0 ; i < 200 ; + + i ) {
@ -729,8 +746,8 @@ TEST_F(DBIteratorTest, DBIteratorUseSkip) {
options . statistics = rocksdb : : CreateDBStatistics ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , i + 2 ,
options . max_sequential_skip_in_iterations ,
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , i + 2 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -765,8 +782,8 @@ TEST_F(DBIteratorTest, DBIteratorUseSkip) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , i + 2 ,
options . max_sequential_skip_in_iterations ,
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , i + 2 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -794,8 +811,8 @@ TEST_F(DBIteratorTest, DBIteratorUseSkip) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 202 ,
options . max_sequential_skip_in_iterations ,
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 202 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -827,8 +844,8 @@ TEST_F(DBIteratorTest, DBIteratorUseSkip) {
internal_iter - > AddPut ( " c " , " 200 " ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , i ,
options . max_sequential_skip_in_iterations ,
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , i , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( ! db_iter - > Valid ( ) ) ;
@ -844,8 +861,9 @@ TEST_F(DBIteratorTest, DBIteratorUseSkip) {
internal_iter - > AddPut ( " c " , " 200 " ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 200 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 200 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " c " ) ;
@ -878,8 +896,8 @@ TEST_F(DBIteratorTest, DBIteratorUseSkip) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , i + 2 ,
options . max_sequential_skip_in_iterations ,
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , i + 2 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -913,8 +931,8 @@ TEST_F(DBIteratorTest, DBIteratorUseSkip) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , i + 2 ,
options . max_sequential_skip_in_iterations ,
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , i + 2 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -945,6 +963,7 @@ TEST_F(DBIteratorTest, DBIteratorUseSkip) {
TEST_F ( DBIteratorTest , DBIteratorSkipInternalKeys ) {
Options options ;
ImmutableCFOptions cf_options = ImmutableCFOptions ( options ) ;
MutableCFOptions mutable_cf_options = MutableCFOptions ( options ) ;
ReadOptions ro ;
// Basic test case ... Make sure explicityly passing the default value works.
@ -962,8 +981,9 @@ TEST_F(DBIteratorTest, DBIteratorSkipInternalKeys) {
ro . max_skippable_internal_keys = 0 ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 10 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -1008,8 +1028,9 @@ TEST_F(DBIteratorTest, DBIteratorSkipInternalKeys) {
ro . max_skippable_internal_keys = 2 ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 10 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -1052,8 +1073,9 @@ TEST_F(DBIteratorTest, DBIteratorSkipInternalKeys) {
ro . max_skippable_internal_keys = 2 ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 10 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -1090,8 +1112,9 @@ TEST_F(DBIteratorTest, DBIteratorSkipInternalKeys) {
ro . max_skippable_internal_keys = 2 ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 10 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -1125,8 +1148,9 @@ TEST_F(DBIteratorTest, DBIteratorSkipInternalKeys) {
ro . max_skippable_internal_keys = 2 ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 10 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -1155,8 +1179,9 @@ TEST_F(DBIteratorTest, DBIteratorSkipInternalKeys) {
ro . max_skippable_internal_keys = 2 ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 10 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -1192,8 +1217,9 @@ TEST_F(DBIteratorTest, DBIteratorSkipInternalKeys) {
ro . max_skippable_internal_keys = 2 ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 10 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -1229,8 +1255,8 @@ TEST_F(DBIteratorTest, DBIteratorSkipInternalKeys) {
ro . max_skippable_internal_keys = i ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 2 * i + 1 ,
options . max_sequential_skip_in_iterations ,
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 2 * i + 1 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
@ -1283,8 +1309,8 @@ TEST_F(DBIteratorTest, DBIteratorSkipInternalKeys) {
options . max_sequential_skip_in_iterations = 1000 ;
ro . max_skippable_internal_keys = i ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 2 * i + 1 ,
options . max_sequential_skip_in_iterations ,
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 2 * i + 1 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
@ -1321,10 +1347,10 @@ TEST_F(DBIteratorTest, DBIterator1) {
internal_iter - > AddMerge ( " b " , " 2 " ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
NewDBIterator ( env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 1 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , ImmutableCFOptions ( options ) , MutableCFOptions ( options ) ,
BytewiseComparator ( ) , internal_iter , 1 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1349,10 +1375,10 @@ TEST_F(DBIteratorTest, DBIterator2) {
internal_iter - > AddMerge ( " b " , " 2 " ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
NewDBIterator ( env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 0 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , ImmutableCFOptions ( options ) , MutableCFOptions ( options ) ,
BytewiseComparator ( ) , internal_iter , 0 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1374,10 +1400,10 @@ TEST_F(DBIteratorTest, DBIterator3) {
internal_iter - > AddMerge ( " b " , " 2 " ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
NewDBIterator ( env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 2 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , ImmutableCFOptions ( options ) , MutableCFOptions ( options ) ,
BytewiseComparator ( ) , internal_iter , 2 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1399,10 +1425,10 @@ TEST_F(DBIteratorTest, DBIterator4) {
internal_iter - > AddMerge ( " b " , " 2 " ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
NewDBIterator ( env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 4 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , ImmutableCFOptions ( options ) , MutableCFOptions ( options ) ,
BytewiseComparator ( ) , internal_iter , 4 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1420,6 +1446,7 @@ TEST_F(DBIteratorTest, DBIterator5) {
Options options ;
options . merge_operator = MergeOperators : : CreateFromStringId ( " stringappend " ) ;
ImmutableCFOptions cf_options = ImmutableCFOptions ( options ) ;
MutableCFOptions mutable_cf_options = MutableCFOptions ( options ) ;
{
TestIterator * internal_iter = new TestIterator ( BytewiseComparator ( ) ) ;
@ -1433,8 +1460,9 @@ TEST_F(DBIteratorTest, DBIterator5) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 0 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 0 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1455,8 +1483,9 @@ TEST_F(DBIteratorTest, DBIterator5) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 1 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 1 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1477,8 +1506,9 @@ TEST_F(DBIteratorTest, DBIterator5) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 2 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 2 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1499,8 +1529,9 @@ TEST_F(DBIteratorTest, DBIterator5) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 3 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 3 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1521,8 +1552,9 @@ TEST_F(DBIteratorTest, DBIterator5) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 4 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 4 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1543,8 +1575,9 @@ TEST_F(DBIteratorTest, DBIterator5) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 5 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 5 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1565,8 +1598,9 @@ TEST_F(DBIteratorTest, DBIterator5) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 6 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 6 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1585,8 +1619,9 @@ TEST_F(DBIteratorTest, DBIterator5) {
internal_iter - > AddPut ( " b " , " val_b " ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 10 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > Seek ( " b " ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " b " ) ;
@ -1601,6 +1636,7 @@ TEST_F(DBIteratorTest, DBIterator6) {
Options options ;
options . merge_operator = MergeOperators : : CreateFromStringId ( " stringappend " ) ;
ImmutableCFOptions cf_options = ImmutableCFOptions ( options ) ;
MutableCFOptions mutable_cf_options = MutableCFOptions ( options ) ;
{
TestIterator * internal_iter = new TestIterator ( BytewiseComparator ( ) ) ;
@ -1614,8 +1650,9 @@ TEST_F(DBIteratorTest, DBIterator6) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 0 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 0 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1636,8 +1673,9 @@ TEST_F(DBIteratorTest, DBIterator6) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 1 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 1 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1658,8 +1696,9 @@ TEST_F(DBIteratorTest, DBIterator6) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 2 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 2 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1680,8 +1719,9 @@ TEST_F(DBIteratorTest, DBIterator6) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 3 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 3 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( ! db_iter - > Valid ( ) ) ;
}
@ -1698,8 +1738,9 @@ TEST_F(DBIteratorTest, DBIterator6) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 4 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 4 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1720,8 +1761,9 @@ TEST_F(DBIteratorTest, DBIterator6) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 5 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 5 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1742,8 +1784,9 @@ TEST_F(DBIteratorTest, DBIterator6) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 6 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 6 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1758,6 +1801,7 @@ TEST_F(DBIteratorTest, DBIterator7) {
Options options ;
options . merge_operator = MergeOperators : : CreateFromStringId ( " stringappend " ) ;
ImmutableCFOptions cf_options = ImmutableCFOptions ( options ) ;
MutableCFOptions mutable_cf_options = MutableCFOptions ( options ) ;
{
TestIterator * internal_iter = new TestIterator ( BytewiseComparator ( ) ) ;
@ -1783,8 +1827,9 @@ TEST_F(DBIteratorTest, DBIterator7) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 0 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 0 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1817,8 +1862,9 @@ TEST_F(DBIteratorTest, DBIterator7) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 2 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 2 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -1857,8 +1903,9 @@ TEST_F(DBIteratorTest, DBIterator7) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 4 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 4 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -1897,8 +1944,9 @@ TEST_F(DBIteratorTest, DBIterator7) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 5 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 5 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -1942,8 +1990,9 @@ TEST_F(DBIteratorTest, DBIterator7) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 6 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 6 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -1988,8 +2037,9 @@ TEST_F(DBIteratorTest, DBIterator7) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 7 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 7 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -2028,8 +2078,9 @@ TEST_F(DBIteratorTest, DBIterator7) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 9 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 9 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -2074,8 +2125,9 @@ TEST_F(DBIteratorTest, DBIterator7) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 13 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 13 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -2121,8 +2173,9 @@ TEST_F(DBIteratorTest, DBIterator7) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 14 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
env_ , ro , cf_options , mutable_cf_options , BytewiseComparator ( ) ,
internal_iter , 14 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -2151,9 +2204,9 @@ TEST_F(DBIteratorTest, DBIterator8) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 10 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
env_ , ro , ImmutableCFOptions ( options ) , MutableCFOptions ( options ) ,
BytewiseComparator ( ) , internal_iter , 10 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " b " ) ;
@ -2182,9 +2235,9 @@ TEST_F(DBIteratorTest, DBIterator9) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 10 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
env_ , ro , ImmutableCFOptions ( options ) , MutableCFOptions ( options ) ,
BytewiseComparator ( ) , internal_iter , 10 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -2249,9 +2302,9 @@ TEST_F(DBIteratorTest, DBIterator10) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 10 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
env_ , ro , ImmutableCFOptions ( options ) , MutableCFOptions ( options ) ,
BytewiseComparator ( ) , internal_iter , 10 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > Seek ( " c " ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -2289,8 +2342,9 @@ TEST_F(DBIteratorTest, SeekToLastOccurrenceSeq0) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 10 , 0 /* force seek */ , nullptr /*read_callback*/ ) ) ;
env_ , ro , ImmutableCFOptions ( options ) , MutableCFOptions ( options ) ,
BytewiseComparator ( ) , internal_iter , 10 , 0 /* force seek */ ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -2316,10 +2370,10 @@ TEST_F(DBIteratorTest, DBIterator11) {
internal_iter - > AddMerge ( " b " , " 2 " ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
NewDBIterator ( env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 1 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , ImmutableCFOptions ( options ) , MutableCFOptions ( options ) ,
BytewiseComparator ( ) , internal_iter , 1 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -2343,9 +2397,9 @@ TEST_F(DBIteratorTest, DBIterator12) {
internal_iter - > AddSingleDeletion ( " b " ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
NewDBIterator ( env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 10 , 0 , nullptr /*read_callback*/ ) ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , ImmutableCFOptions ( options ) , MutableCFOptions ( options ) ,
BytewiseComparator ( ) , internal_iter , 10 , 0 , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " c " ) ;
@ -2380,9 +2434,9 @@ TEST_F(DBIteratorTest, DBIterator13) {
internal_iter - > AddPut ( key , " 8 " ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
NewDBIterator ( env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 2 , 3 , nullptr /*read_callback*/ ) ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , ImmutableCFOptions ( options ) , MutableCFOptions ( options ) ,
BytewiseComparator ( ) , internal_iter , 2 , 3 , nullptr /*read_callback*/ ) ) ;
db_iter - > Seek ( " b " ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , key ) ;
@ -2408,9 +2462,9 @@ TEST_F(DBIteratorTest, DBIterator14) {
internal_iter - > AddPut ( " c " , " 9 " ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
NewDBIterator ( env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 4 , 1 , nullptr /*read_callback*/ ) ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , ImmutableCFOptions ( options ) , MutableCFOptions ( options ) ,
BytewiseComparator ( ) , internal_iter , 4 , 1 , nullptr /*read_callback*/ ) ) ;
db_iter - > Seek ( " b " ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " b " ) ;
@ -2435,9 +2489,9 @@ TEST_F(DBIteratorTest, DBIteratorTestDifferentialSnapshots) {
}
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
NewDBIterator ( env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 13 ,
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , ImmutableCFOptions ( options ) , MutableCFOptions ( options ) ,
BytewiseComparator ( ) , internal_iter , 13 ,
options . max_sequential_skip_in_iterations , nullptr ) ) ;
// Expecting InternalKeys in [5,8] range with correct type
int seqnums [ 4 ] = { 5 , 8 , 11 , 13 } ;
@ -2470,9 +2524,9 @@ TEST_F(DBIteratorTest, DBIteratorTestDifferentialSnapshots) {
}
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
NewDBIterator ( env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 13 ,
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , ImmutableCFOptions ( options ) , MutableCFOptions ( options ) ,
BytewiseComparator ( ) , internal_iter , 13 ,
options . max_sequential_skip_in_iterations , nullptr ) ) ;
// Expecting InternalKeys in [5,8] range with correct type
int seqnums [ 4 ] = { 5 , 8 , 11 , 13 } ;
@ -2521,8 +2575,9 @@ class DBIterWithMergeIterTest : public testing::Test {
NewMergingIterator ( & icomp_ , & child_iters [ 0 ] , 2u ) ;
db_iter_ . reset ( NewDBIterator (
env_ , ro_ , ImmutableCFOptions ( options_ ) , BytewiseComparator ( ) ,
merge_iter , 8 /* read data earlier than seqId 8 */ ,
env_ , ro_ , ImmutableCFOptions ( options_ ) , MutableCFOptions ( options_ ) ,
BytewiseComparator ( ) , merge_iter ,
8 /* read data earlier than seqId 8 */ ,
3 /* max iterators before reseek */ , nullptr /*read_callback*/ ) ) ;
}
@ -2960,9 +3015,9 @@ TEST_F(DBIteratorTest, SeekPrefixTombstones) {
ro . prefix_same_as_start = true ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 10 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
env_ , ro , ImmutableCFOptions ( options ) , MutableCFOptions ( options ) ,
BytewiseComparator ( ) , internal_iter , 10 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
int skipped_keys = 0 ;
@ -2996,9 +3051,10 @@ TEST_F(DBIteratorTest, SeekToFirstLowerBound) {
ro . iterate_lower_bound = & lower_bound ;
Options options ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 10 /* sequence */ ,
options . max_sequential_skip_in_iterations , nullptr /* read_callback */ ) ) ;
env_ , ro , ImmutableCFOptions ( options ) , MutableCFOptions ( options ) ,
BytewiseComparator ( ) , internal_iter , 10 /* sequence */ ,
options . max_sequential_skip_in_iterations ,
nullptr /* read_callback */ ) ) ;
db_iter - > SeekToFirst ( ) ;
if ( i = = kNumKeys + 1 ) {
@ -3034,8 +3090,8 @@ TEST_F(DBIteratorTest, PrevLowerBound) {
ro . iterate_lower_bound = & lower_bound ;
Options options ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 10 /* sequence */ ,
env_ , ro , ImmutableCFOptions ( options ) , MutableCFOptions ( options ) ,
BytewiseComparator ( ) , internal_iter , 10 /* sequence */ ,
options . max_sequential_skip_in_iterations , nullptr /* read_callback */ ) ) ;
db_iter - > SeekToLast ( ) ;
@ -3062,8 +3118,8 @@ TEST_F(DBIteratorTest, SeekLessLowerBound) {
ro . iterate_lower_bound = & lower_bound ;
Options options ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 10 /* sequence */ ,
env_ , ro , ImmutableCFOptions ( options ) , MutableCFOptions ( options ) ,
BytewiseComparator ( ) , internal_iter , 10 /* sequence */ ,
options . max_sequential_skip_in_iterations , nullptr /* read_callback */ ) ) ;
auto before_lower_bound_str = std : : to_string ( kLowerBound - 1 ) ;
@ -3087,9 +3143,9 @@ TEST_F(DBIteratorTest, ReverseToForwardWithDisappearingKeys) {
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ReadOptions ( ) , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 10 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
env_ , ReadOptions ( ) , ImmutableCFOptions ( options ) ,
MutableCFOptions ( options ) , BytewiseComparator ( ) , internal_iter , 10 ,
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekForPrev ( " a " ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;