@ -191,9 +191,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
ReadOptions ro ;
ReadOptions ro ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
10 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -223,9 +223,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
ReadOptions ro ;
ReadOptions ro ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
10 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -249,9 +249,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
ReadOptions ro ;
ReadOptions ro ;
ro . iterate_upper_bound = & prefix ;
ro . iterate_upper_bound = & prefix ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
10 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -281,9 +281,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
ReadOptions ro ;
ReadOptions ro ;
ro . iterate_upper_bound = & prefix ;
ro . iterate_upper_bound = & prefix ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
10 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -316,9 +316,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
ReadOptions ro ;
ReadOptions ro ;
ro . iterate_upper_bound = & prefix ;
ro . iterate_upper_bound = & prefix ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
10 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( ! db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( ! db_iter - > Valid ( ) ) ;
@ -345,9 +345,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
ReadOptions ro ;
ReadOptions ro ;
ro . iterate_upper_bound = & prefix ;
ro . iterate_upper_bound = & prefix ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 7 ,
7 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
SetPerfLevel ( kEnableCount ) ;
SetPerfLevel ( kEnableCount ) ;
ASSERT_TRUE ( GetPerfLevel ( ) = = kEnableCount ) ;
ASSERT_TRUE ( GetPerfLevel ( ) = = kEnableCount ) ;
@ -382,9 +382,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
ReadOptions ro ;
ReadOptions ro ;
ro . iterate_upper_bound = & prefix ;
ro . iterate_upper_bound = & prefix ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 4 ,
4 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -407,9 +407,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
ReadOptions ro ;
ReadOptions ro ;
ro . iterate_upper_bound = & prefix ;
ro . iterate_upper_bound = & prefix ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
10 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( ! db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( ! db_iter - > Valid ( ) ) ;
@ -429,9 +429,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
ReadOptions ro ;
ReadOptions ro ;
ro . iterate_upper_bound = & prefix ;
ro . iterate_upper_bound = & prefix ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
10 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -464,9 +464,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
ReadOptions ro ;
ReadOptions ro ;
ro . iterate_upper_bound = & prefix ;
ro . iterate_upper_bound = & prefix ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 7 ,
7 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
SetPerfLevel ( kEnableCount ) ;
SetPerfLevel ( kEnableCount ) ;
ASSERT_TRUE ( GetPerfLevel ( ) = = kEnableCount ) ;
ASSERT_TRUE ( GetPerfLevel ( ) = = kEnableCount ) ;
@ -493,9 +493,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
ReadOptions ro ;
ReadOptions ro ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
10 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -535,9 +535,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
ReadOptions ro ;
ReadOptions ro ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 2 ,
2 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " b " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " b " ) ;
@ -566,9 +566,9 @@ TEST_F(DBIteratorTest, DBIteratorPrevNext) {
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
ReadOptions ro ;
ReadOptions ro ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
10 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " c " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " c " ) ;
@ -595,9 +595,9 @@ TEST_F(DBIteratorTest, DBIteratorEmpty) {
TestIterator * internal_iter = new TestIterator ( BytewiseComparator ( ) ) ;
TestIterator * internal_iter = new TestIterator ( BytewiseComparator ( ) ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 0 ,
0 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( ! db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( ! db_iter - > Valid ( ) ) ;
}
}
@ -606,9 +606,9 @@ TEST_F(DBIteratorTest, DBIteratorEmpty) {
TestIterator * internal_iter = new TestIterator ( BytewiseComparator ( ) ) ;
TestIterator * internal_iter = new TestIterator ( BytewiseComparator ( ) ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 0 ,
0 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( ! db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( ! db_iter - > Valid ( ) ) ;
}
}
@ -628,9 +628,10 @@ TEST_F(DBIteratorTest, DBIteratorUseSkipCountSkips) {
}
}
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
std : : unique_ptr < Iterator > db_iter (
env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
NewDBIterator ( env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 2 , options . max_sequential_skip_in_iterations ) ) ;
internal_iter , 2 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " c " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " c " ) ;
@ -673,7 +674,8 @@ TEST_F(DBIteratorTest, DBIteratorUseSkip) {
options . statistics = rocksdb : : CreateDBStatistics ( ) ;
options . statistics = rocksdb : : CreateDBStatistics ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , i + 2 ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , i + 2 ,
options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -708,7 +710,8 @@ TEST_F(DBIteratorTest, DBIteratorUseSkip) {
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , i + 2 ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , i + 2 ,
options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -736,7 +739,8 @@ TEST_F(DBIteratorTest, DBIteratorUseSkip) {
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 202 ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 202 ,
options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -768,7 +772,8 @@ TEST_F(DBIteratorTest, DBIteratorUseSkip) {
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , i ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , i ,
options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( ! db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( ! db_iter - > Valid ( ) ) ;
@ -782,9 +787,9 @@ TEST_F(DBIteratorTest, DBIteratorUseSkip) {
}
}
internal_iter - > AddPut ( " c " , " 200 " ) ;
internal_iter - > AddPut ( " c " , " 200 " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 200 ,
200 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " c " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " c " ) ;
@ -818,7 +823,8 @@ TEST_F(DBIteratorTest, DBIteratorUseSkip) {
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , i + 2 ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , i + 2 ,
options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -852,7 +858,8 @@ TEST_F(DBIteratorTest, DBIteratorUseSkip) {
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , i + 2 ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , i + 2 ,
options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -898,9 +905,9 @@ TEST_F(DBIteratorTest, DBIteratorSkipInternalKeys) {
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
ro . max_skippable_internal_keys = 0 ;
ro . max_skippable_internal_keys = 0 ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
10 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -944,9 +951,9 @@ TEST_F(DBIteratorTest, DBIteratorSkipInternalKeys) {
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
ro . max_skippable_internal_keys = 2 ;
ro . max_skippable_internal_keys = 2 ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
10 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -988,9 +995,9 @@ TEST_F(DBIteratorTest, DBIteratorSkipInternalKeys) {
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
ro . max_skippable_internal_keys = 2 ;
ro . max_skippable_internal_keys = 2 ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
10 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -1026,9 +1033,9 @@ TEST_F(DBIteratorTest, DBIteratorSkipInternalKeys) {
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
ro . max_skippable_internal_keys = 2 ;
ro . max_skippable_internal_keys = 2 ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
10 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -1061,9 +1068,9 @@ TEST_F(DBIteratorTest, DBIteratorSkipInternalKeys) {
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
ro . max_skippable_internal_keys = 2 ;
ro . max_skippable_internal_keys = 2 ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
10 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -1091,9 +1098,9 @@ TEST_F(DBIteratorTest, DBIteratorSkipInternalKeys) {
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
ro . max_skippable_internal_keys = 2 ;
ro . max_skippable_internal_keys = 2 ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
10 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -1128,9 +1135,9 @@ TEST_F(DBIteratorTest, DBIteratorSkipInternalKeys) {
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
ro . max_skippable_internal_keys = 2 ;
ro . max_skippable_internal_keys = 2 ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
10 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -1167,7 +1174,8 @@ TEST_F(DBIteratorTest, DBIteratorSkipInternalKeys) {
ro . max_skippable_internal_keys = i ;
ro . max_skippable_internal_keys = i ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 2 * i + 1 ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 2 * i + 1 ,
options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -1220,7 +1228,8 @@ TEST_F(DBIteratorTest, DBIteratorSkipInternalKeys) {
ro . max_skippable_internal_keys = i ;
ro . max_skippable_internal_keys = i ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 2 * i + 1 ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 2 * i + 1 ,
options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -1256,9 +1265,10 @@ TEST_F(DBIteratorTest, DBIterator1) {
internal_iter - > AddMerge ( " b " , " 2 " ) ;
internal_iter - > AddMerge ( " b " , " 2 " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
std : : unique_ptr < Iterator > db_iter (
env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
NewDBIterator ( env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 1 , options . max_sequential_skip_in_iterations ) ) ;
internal_iter , 1 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1283,9 +1293,10 @@ TEST_F(DBIteratorTest, DBIterator2) {
internal_iter - > AddMerge ( " b " , " 2 " ) ;
internal_iter - > AddMerge ( " b " , " 2 " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
std : : unique_ptr < Iterator > db_iter (
env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
NewDBIterator ( env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 0 , options . max_sequential_skip_in_iterations ) ) ;
internal_iter , 0 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1307,9 +1318,10 @@ TEST_F(DBIteratorTest, DBIterator3) {
internal_iter - > AddMerge ( " b " , " 2 " ) ;
internal_iter - > AddMerge ( " b " , " 2 " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
std : : unique_ptr < Iterator > db_iter (
env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
NewDBIterator ( env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 2 , options . max_sequential_skip_in_iterations ) ) ;
internal_iter , 2 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1331,9 +1343,10 @@ TEST_F(DBIteratorTest, DBIterator4) {
internal_iter - > AddMerge ( " b " , " 2 " ) ;
internal_iter - > AddMerge ( " b " , " 2 " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
std : : unique_ptr < Iterator > db_iter (
env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
NewDBIterator ( env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 4 , options . max_sequential_skip_in_iterations ) ) ;
internal_iter , 4 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1363,9 +1376,9 @@ TEST_F(DBIteratorTest, DBIterator5) {
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 0 ,
0 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1385,9 +1398,9 @@ TEST_F(DBIteratorTest, DBIterator5) {
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 1 ,
1 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1407,9 +1420,9 @@ TEST_F(DBIteratorTest, DBIterator5) {
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 2 ,
2 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1429,9 +1442,9 @@ TEST_F(DBIteratorTest, DBIterator5) {
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 3 ,
3 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1451,9 +1464,9 @@ TEST_F(DBIteratorTest, DBIterator5) {
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 4 ,
4 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1473,9 +1486,9 @@ TEST_F(DBIteratorTest, DBIterator5) {
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 5 ,
5 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1495,9 +1508,9 @@ TEST_F(DBIteratorTest, DBIterator5) {
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 6 ,
6 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1515,9 +1528,9 @@ TEST_F(DBIteratorTest, DBIterator5) {
internal_iter - > AddMerge ( " a " , " merge_2 " ) ;
internal_iter - > AddMerge ( " a " , " merge_2 " ) ;
internal_iter - > AddPut ( " b " , " val_b " ) ;
internal_iter - > AddPut ( " b " , " val_b " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 10 ,
10 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > Seek ( " b " ) ;
db_iter - > Seek ( " b " ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " b " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " b " ) ;
@ -1544,9 +1557,9 @@ TEST_F(DBIteratorTest, DBIterator6) {
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 0 ,
0 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1566,9 +1579,9 @@ TEST_F(DBIteratorTest, DBIterator6) {
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 1 ,
1 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1588,9 +1601,9 @@ TEST_F(DBIteratorTest, DBIterator6) {
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 2 ,
2 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1610,9 +1623,9 @@ TEST_F(DBIteratorTest, DBIterator6) {
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 3 ,
3 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( ! db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( ! db_iter - > Valid ( ) ) ;
}
}
@ -1628,9 +1641,9 @@ TEST_F(DBIteratorTest, DBIterator6) {
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 4 ,
4 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1650,9 +1663,9 @@ TEST_F(DBIteratorTest, DBIterator6) {
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 5 ,
5 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1672,9 +1685,9 @@ TEST_F(DBIteratorTest, DBIterator6) {
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > AddMerge ( " a " , " merge_6 " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 6 ,
6 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1713,9 +1726,9 @@ TEST_F(DBIteratorTest, DBIterator7) {
internal_iter - > AddDeletion ( " c " ) ;
internal_iter - > AddDeletion ( " c " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 0 ,
0 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -1747,9 +1760,9 @@ TEST_F(DBIteratorTest, DBIterator7) {
internal_iter - > AddDeletion ( " c " ) ;
internal_iter - > AddDeletion ( " c " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 2 ,
2 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -1787,9 +1800,9 @@ TEST_F(DBIteratorTest, DBIterator7) {
internal_iter - > AddDeletion ( " c " ) ;
internal_iter - > AddDeletion ( " c " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 4 ,
4 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -1827,9 +1840,9 @@ TEST_F(DBIteratorTest, DBIterator7) {
internal_iter - > AddDeletion ( " c " ) ;
internal_iter - > AddDeletion ( " c " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 5 ,
5 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -1872,9 +1885,9 @@ TEST_F(DBIteratorTest, DBIterator7) {
internal_iter - > AddDeletion ( " c " ) ;
internal_iter - > AddDeletion ( " c " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 6 ,
6 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -1918,9 +1931,9 @@ TEST_F(DBIteratorTest, DBIterator7) {
internal_iter - > AddDeletion ( " c " ) ;
internal_iter - > AddDeletion ( " c " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 7 ,
7 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -1958,9 +1971,9 @@ TEST_F(DBIteratorTest, DBIterator7) {
internal_iter - > AddDeletion ( " c " ) ;
internal_iter - > AddDeletion ( " c " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 9 ,
9 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -2004,9 +2017,9 @@ TEST_F(DBIteratorTest, DBIterator7) {
internal_iter - > AddDeletion ( " c " ) ;
internal_iter - > AddDeletion ( " c " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 13 ,
13 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -2051,9 +2064,9 @@ TEST_F(DBIteratorTest, DBIterator7) {
internal_iter - > AddDeletion ( " c " ) ;
internal_iter - > AddDeletion ( " c " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter ,
env_ , ro , cf_options , BytewiseComparator ( ) , internal_iter , 14 ,
14 , options . max_sequential_skip_in_iterations ) ) ;
options . max_sequential_skip_in_iterations , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -2083,7 +2096,8 @@ TEST_F(DBIteratorTest, DBIterator8) {
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 10 , options . max_sequential_skip_in_iterations ) ) ;
internal_iter , 10 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " b " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " b " ) ;
@ -2113,7 +2127,8 @@ TEST_F(DBIteratorTest, DBIterator9) {
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 10 , options . max_sequential_skip_in_iterations ) ) ;
internal_iter , 10 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -2179,7 +2194,8 @@ TEST_F(DBIteratorTest, DBIterator10) {
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 10 , options . max_sequential_skip_in_iterations ) ) ;
internal_iter , 10 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > Seek ( " c " ) ;
db_iter - > Seek ( " c " ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
@ -2216,9 +2232,9 @@ TEST_F(DBIteratorTest, SeekToLastOccurrenceSeq0) {
internal_iter - > AddPut ( " b " , " 2 " ) ;
internal_iter - > AddPut ( " b " , " 2 " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
NewDBIterator ( env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 10 , 0 /* force seek */ ) ) ;
internal_iter , 10 , 0 /* force seek */ , nullptr /*read_callback */ ) ) ;
db_iter - > SeekToFirst ( ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -2244,9 +2260,10 @@ TEST_F(DBIteratorTest, DBIterator11) {
internal_iter - > AddMerge ( " b " , " 2 " ) ;
internal_iter - > AddMerge ( " b " , " 2 " ) ;
internal_iter - > Finish ( ) ;
internal_iter - > Finish ( ) ;
std : : unique_ptr < Iterator > db_iter ( NewDBIterator (
std : : unique_ptr < Iterator > db_iter (
env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
NewDBIterator ( env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 1 , options . max_sequential_skip_in_iterations ) ) ;
internal_iter , 1 , options . max_sequential_skip_in_iterations ,
nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToFirst ( ) ;
db_iter - > SeekToFirst ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " a " ) ;
@ -2272,7 +2289,7 @@ TEST_F(DBIteratorTest, DBIterator12) {
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter (
NewDBIterator ( env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
NewDBIterator ( env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 10 , 0 ) ) ;
internal_iter , 10 , 0 , nullptr /*read_callback*/ ) ) ;
db_iter - > SeekToLast ( ) ;
db_iter - > SeekToLast ( ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " c " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " c " ) ;
@ -2309,7 +2326,7 @@ TEST_F(DBIteratorTest, DBIterator13) {
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter (
NewDBIterator ( env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
NewDBIterator ( env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 2 , 3 ) ) ;
internal_iter , 2 , 3 , nullptr /*read_callback*/ ) ) ;
db_iter - > Seek ( " b " ) ;
db_iter - > Seek ( " b " ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , key ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , key ) ;
@ -2337,7 +2354,7 @@ TEST_F(DBIteratorTest, DBIterator14) {
std : : unique_ptr < Iterator > db_iter (
std : : unique_ptr < Iterator > db_iter (
NewDBIterator ( env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
NewDBIterator ( env_ , ro , ImmutableCFOptions ( options ) , BytewiseComparator ( ) ,
internal_iter , 4 , 1 ) ) ;
internal_iter , 4 , 1 , nullptr /*read_callback*/ ) ) ;
db_iter - > Seek ( " b " ) ;
db_iter - > Seek ( " b " ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_TRUE ( db_iter - > Valid ( ) ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " b " ) ;
ASSERT_EQ ( db_iter - > key ( ) . ToString ( ) , " b " ) ;
@ -2373,10 +2390,10 @@ class DBIterWithMergeIterTest : public testing::Test {
InternalIterator * merge_iter =
InternalIterator * merge_iter =
NewMergingIterator ( & icomp_ , & child_iters [ 0 ] , 2u ) ;
NewMergingIterator ( & icomp_ , & child_iters [ 0 ] , 2u ) ;
db_iter_ . reset ( NewDBIterator ( env_ , ro_ , ImmutableCFOptions ( options_ ) ,
db_iter_ . reset ( NewDBIterator (
BytewiseComparator ( ) , merge_iter ,
env_ , ro_ , ImmutableCFOptions ( options_ ) , BytewiseComparator ( ) ,
8 /* read data earlier than seqId 8 */ ,
merge_iter , 8 /* read data earlier than seqId 8 */ ,
3 /* max iterators before reseek */ ) ) ;
3 /* max iterators before reseek */ , nullptr /*read_callback */ ) ) ;
}
}
Env * env_ ;
Env * env_ ;