@ -3670,14 +3670,15 @@ TEST_F(DBTest2, IterRaceFlush1) {
TEST_SYNC_POINT ( " DBTest2::IterRaceFlush:2 " ) ;
TEST_SYNC_POINT ( " DBTest2::IterRaceFlush:2 " ) ;
} ) ;
} ) ;
// iterator is created after the first Put(), so it should see either
// iterator is created after the first Put(), and its snapshot sequence is
// "v1" or "v2" .
// assigned after second Put(), so it must see v2 .
{
{
std : : unique_ptr < Iterator > it ( db_ - > NewIterator ( ReadOptions ( ) ) ) ;
std : : unique_ptr < Iterator > it ( db_ - > NewIterator ( ReadOptions ( ) ) ) ;
it - > Seek ( " foo " ) ;
it - > Seek ( " foo " ) ;
ASSERT_TRUE ( it - > Valid ( ) ) ;
ASSERT_TRUE ( it - > Valid ( ) ) ;
ASSERT_OK ( it - > status ( ) ) ;
ASSERT_OK ( it - > status ( ) ) ;
ASSERT_EQ ( " foo " , it - > key ( ) . ToString ( ) ) ;
ASSERT_EQ ( " foo " , it - > key ( ) . ToString ( ) ) ;
ASSERT_EQ ( " v2 " , it - > value ( ) . ToString ( ) ) ;
}
}
t1 . join ( ) ;
t1 . join ( ) ;
@ -3700,14 +3701,15 @@ TEST_F(DBTest2, IterRaceFlush2) {
TEST_SYNC_POINT ( " DBTest2::IterRaceFlush2:2 " ) ;
TEST_SYNC_POINT ( " DBTest2::IterRaceFlush2:2 " ) ;
} ) ;
} ) ;
// iterator is created after the first Put(), so it should see either
// iterator is created after the first Put(), and its snapshot sequence is
// "v1" or "v2" .
// assigned before second Put(), thus it must see v1 .
{
{
std : : unique_ptr < Iterator > it ( db_ - > NewIterator ( ReadOptions ( ) ) ) ;
std : : unique_ptr < Iterator > it ( db_ - > NewIterator ( ReadOptions ( ) ) ) ;
it - > Seek ( " foo " ) ;
it - > Seek ( " foo " ) ;
ASSERT_TRUE ( it - > Valid ( ) ) ;
ASSERT_TRUE ( it - > Valid ( ) ) ;
ASSERT_OK ( it - > status ( ) ) ;
ASSERT_OK ( it - > status ( ) ) ;
ASSERT_EQ ( " foo " , it - > key ( ) . ToString ( ) ) ;
ASSERT_EQ ( " foo " , it - > key ( ) . ToString ( ) ) ;
ASSERT_EQ ( " v1 " , it - > value ( ) . ToString ( ) ) ;
}
}
t1 . join ( ) ;
t1 . join ( ) ;
@ -3730,8 +3732,8 @@ TEST_F(DBTest2, IterRefreshRaceFlush) {
TEST_SYNC_POINT ( " DBTest2::IterRefreshRaceFlush:2 " ) ;
TEST_SYNC_POINT ( " DBTest2::IterRefreshRaceFlush:2 " ) ;
} ) ;
} ) ;
// iterator is created after the first Put(), so it should see either
// iterator is refreshed after the first Put(), and its sequence number is
// "v1" or "v2" .
// assigned after second Put(), thus it must see v2 .
{
{
std : : unique_ptr < Iterator > it ( db_ - > NewIterator ( ReadOptions ( ) ) ) ;
std : : unique_ptr < Iterator > it ( db_ - > NewIterator ( ReadOptions ( ) ) ) ;
ASSERT_OK ( it - > status ( ) ) ;
ASSERT_OK ( it - > status ( ) ) ;
@ -3740,6 +3742,7 @@ TEST_F(DBTest2, IterRefreshRaceFlush) {
ASSERT_TRUE ( it - > Valid ( ) ) ;
ASSERT_TRUE ( it - > Valid ( ) ) ;
ASSERT_OK ( it - > status ( ) ) ;
ASSERT_OK ( it - > status ( ) ) ;
ASSERT_EQ ( " foo " , it - > key ( ) . ToString ( ) ) ;
ASSERT_EQ ( " foo " , it - > key ( ) . ToString ( ) ) ;
ASSERT_EQ ( " v2 " , it - > value ( ) . ToString ( ) ) ;
}
}
t1 . join ( ) ;
t1 . join ( ) ;