|
|
@ -1842,7 +1842,7 @@ TEST_F(DBIteratorTest, DBIterator12) { |
|
|
|
ASSERT_FALSE(db_iter->Valid()); |
|
|
|
ASSERT_FALSE(db_iter->Valid()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
class DBIterWithMergeIterTest : public ::testing::TestWithParam<bool> { |
|
|
|
class DBIterWithMergeIterTest : public testing::Test { |
|
|
|
public: |
|
|
|
public: |
|
|
|
DBIterWithMergeIterTest() |
|
|
|
DBIterWithMergeIterTest() |
|
|
|
: env_(Env::Default()), icomp_(BytewiseComparator()) { |
|
|
|
: env_(Env::Default()), icomp_(BytewiseComparator()) { |
|
|
@ -1865,11 +1865,9 @@ class DBIterWithMergeIterTest : public ::testing::TestWithParam<bool> { |
|
|
|
child_iters.push_back(internal_iter1_); |
|
|
|
child_iters.push_back(internal_iter1_); |
|
|
|
child_iters.push_back(internal_iter2_); |
|
|
|
child_iters.push_back(internal_iter2_); |
|
|
|
InternalKeyComparator icomp(BytewiseComparator()); |
|
|
|
InternalKeyComparator icomp(BytewiseComparator()); |
|
|
|
if (GetParam() == false) { |
|
|
|
InternalIterator* merge_iter = |
|
|
|
options_.prefix_extractor.reset(NewFixedPrefixTransform(0)); |
|
|
|
NewMergingIterator(&icomp_, &child_iters[0], 2u); |
|
|
|
} |
|
|
|
|
|
|
|
InternalIterator* merge_iter = NewMergingIterator( |
|
|
|
|
|
|
|
&icomp_, &child_iters[0], 2u, nullptr, options_.prefix_extractor.get()); |
|
|
|
|
|
|
|
db_iter_.reset(NewDBIterator(env_, ImmutableCFOptions(options_), |
|
|
|
db_iter_.reset(NewDBIterator(env_, ImmutableCFOptions(options_), |
|
|
|
BytewiseComparator(), merge_iter, |
|
|
|
BytewiseComparator(), merge_iter, |
|
|
|
8 /* read data earlier than seqId 8 */, |
|
|
|
8 /* read data earlier than seqId 8 */, |
|
|
@ -1885,7 +1883,7 @@ class DBIterWithMergeIterTest : public ::testing::TestWithParam<bool> { |
|
|
|
std::unique_ptr<Iterator> db_iter_; |
|
|
|
std::unique_ptr<Iterator> db_iter_; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
TEST_P(DBIterWithMergeIterTest, InnerMergeIterator1) { |
|
|
|
TEST_F(DBIterWithMergeIterTest, InnerMergeIterator1) { |
|
|
|
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"); |
|
|
@ -1914,7 +1912,7 @@ TEST_P(DBIterWithMergeIterTest, InnerMergeIterator1) { |
|
|
|
ASSERT_FALSE(db_iter_->Valid()); |
|
|
|
ASSERT_FALSE(db_iter_->Valid()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TEST_P(DBIterWithMergeIterTest, InnerMergeIterator2) { |
|
|
|
TEST_F(DBIterWithMergeIterTest, InnerMergeIterator2) { |
|
|
|
// Test Prev() when one child iterator is at its end.
|
|
|
|
// Test Prev() when one child iterator is at its end.
|
|
|
|
db_iter_->Seek("g"); |
|
|
|
db_iter_->Seek("g"); |
|
|
|
ASSERT_TRUE(db_iter_->Valid()); |
|
|
|
ASSERT_TRUE(db_iter_->Valid()); |
|
|
@ -1942,7 +1940,7 @@ TEST_P(DBIterWithMergeIterTest, InnerMergeIterator2) { |
|
|
|
ASSERT_EQ(db_iter_->value().ToString(), "4"); |
|
|
|
ASSERT_EQ(db_iter_->value().ToString(), "4"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TEST_P(DBIterWithMergeIterTest, InnerMergeIteratorDataRace1) { |
|
|
|
TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace1) { |
|
|
|
// Test Prev() when one child iterator is at its end but more rows
|
|
|
|
// Test Prev() when one child iterator is at its end but more rows
|
|
|
|
// are added.
|
|
|
|
// are added.
|
|
|
|
db_iter_->Seek("f"); |
|
|
|
db_iter_->Seek("f"); |
|
|
@ -1978,7 +1976,7 @@ TEST_P(DBIterWithMergeIterTest, InnerMergeIteratorDataRace1) { |
|
|
|
rocksdb::SyncPoint::GetInstance()->DisableProcessing(); |
|
|
|
rocksdb::SyncPoint::GetInstance()->DisableProcessing(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TEST_P(DBIterWithMergeIterTest, InnerMergeIteratorDataRace2) { |
|
|
|
TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace2) { |
|
|
|
// Test Prev() when one child iterator is at its end but more rows
|
|
|
|
// Test Prev() when one child iterator is at its end but more rows
|
|
|
|
// are added.
|
|
|
|
// are added.
|
|
|
|
db_iter_->Seek("f"); |
|
|
|
db_iter_->Seek("f"); |
|
|
@ -2016,7 +2014,7 @@ TEST_P(DBIterWithMergeIterTest, InnerMergeIteratorDataRace2) { |
|
|
|
rocksdb::SyncPoint::GetInstance()->DisableProcessing(); |
|
|
|
rocksdb::SyncPoint::GetInstance()->DisableProcessing(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TEST_P(DBIterWithMergeIterTest, InnerMergeIteratorDataRace3) { |
|
|
|
TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace3) { |
|
|
|
// Test Prev() when one child iterator is at its end but more rows
|
|
|
|
// Test Prev() when one child iterator is at its end but more rows
|
|
|
|
// are added and max_skipped is triggered.
|
|
|
|
// are added and max_skipped is triggered.
|
|
|
|
db_iter_->Seek("f"); |
|
|
|
db_iter_->Seek("f"); |
|
|
@ -2058,7 +2056,7 @@ TEST_P(DBIterWithMergeIterTest, InnerMergeIteratorDataRace3) { |
|
|
|
rocksdb::SyncPoint::GetInstance()->DisableProcessing(); |
|
|
|
rocksdb::SyncPoint::GetInstance()->DisableProcessing(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TEST_P(DBIterWithMergeIterTest, InnerMergeIteratorDataRace4) { |
|
|
|
TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace4) { |
|
|
|
// Test Prev() when one child iterator has more rows inserted
|
|
|
|
// Test Prev() when one child iterator has more rows inserted
|
|
|
|
// between Seek() and Prev() when changing directions.
|
|
|
|
// between Seek() and Prev() when changing directions.
|
|
|
|
internal_iter2_->Add("z", kTypeValue, "9", 4u); |
|
|
|
internal_iter2_->Add("z", kTypeValue, "9", 4u); |
|
|
@ -2109,7 +2107,7 @@ TEST_P(DBIterWithMergeIterTest, InnerMergeIteratorDataRace4) { |
|
|
|
rocksdb::SyncPoint::GetInstance()->DisableProcessing(); |
|
|
|
rocksdb::SyncPoint::GetInstance()->DisableProcessing(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TEST_P(DBIterWithMergeIterTest, InnerMergeIteratorDataRace5) { |
|
|
|
TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace5) { |
|
|
|
internal_iter2_->Add("z", kTypeValue, "9", 4u); |
|
|
|
internal_iter2_->Add("z", kTypeValue, "9", 4u); |
|
|
|
|
|
|
|
|
|
|
|
// Test Prev() when one child iterator has more rows inserted
|
|
|
|
// Test Prev() when one child iterator has more rows inserted
|
|
|
@ -2156,7 +2154,7 @@ TEST_P(DBIterWithMergeIterTest, InnerMergeIteratorDataRace5) { |
|
|
|
rocksdb::SyncPoint::GetInstance()->DisableProcessing(); |
|
|
|
rocksdb::SyncPoint::GetInstance()->DisableProcessing(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TEST_P(DBIterWithMergeIterTest, InnerMergeIteratorDataRace6) { |
|
|
|
TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace6) { |
|
|
|
internal_iter2_->Add("z", kTypeValue, "9", 4u); |
|
|
|
internal_iter2_->Add("z", kTypeValue, "9", 4u); |
|
|
|
|
|
|
|
|
|
|
|
// Test Prev() when one child iterator has more rows inserted
|
|
|
|
// Test Prev() when one child iterator has more rows inserted
|
|
|
@ -2202,7 +2200,7 @@ TEST_P(DBIterWithMergeIterTest, InnerMergeIteratorDataRace6) { |
|
|
|
rocksdb::SyncPoint::GetInstance()->DisableProcessing(); |
|
|
|
rocksdb::SyncPoint::GetInstance()->DisableProcessing(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TEST_P(DBIterWithMergeIterTest, InnerMergeIteratorDataRace7) { |
|
|
|
TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace7) { |
|
|
|
internal_iter1_->Add("u", kTypeValue, "10", 4u); |
|
|
|
internal_iter1_->Add("u", kTypeValue, "10", 4u); |
|
|
|
internal_iter1_->Add("v", kTypeValue, "11", 4u); |
|
|
|
internal_iter1_->Add("v", kTypeValue, "11", 4u); |
|
|
|
internal_iter1_->Add("w", kTypeValue, "12", 4u); |
|
|
|
internal_iter1_->Add("w", kTypeValue, "12", 4u); |
|
|
@ -2256,7 +2254,7 @@ TEST_P(DBIterWithMergeIterTest, InnerMergeIteratorDataRace7) { |
|
|
|
rocksdb::SyncPoint::GetInstance()->DisableProcessing(); |
|
|
|
rocksdb::SyncPoint::GetInstance()->DisableProcessing(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TEST_P(DBIterWithMergeIterTest, InnerMergeIteratorDataRace8) { |
|
|
|
TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace8) { |
|
|
|
// internal_iter1_: a, f, g
|
|
|
|
// internal_iter1_: a, f, g
|
|
|
|
// internal_iter2_: a, b, c, d, adding (z)
|
|
|
|
// internal_iter2_: a, b, c, d, adding (z)
|
|
|
|
internal_iter2_->Add("z", kTypeValue, "9", 4u); |
|
|
|
internal_iter2_->Add("z", kTypeValue, "9", 4u); |
|
|
@ -2292,10 +2290,6 @@ TEST_P(DBIterWithMergeIterTest, InnerMergeIteratorDataRace8) { |
|
|
|
|
|
|
|
|
|
|
|
rocksdb::SyncPoint::GetInstance()->DisableProcessing(); |
|
|
|
rocksdb::SyncPoint::GetInstance()->DisableProcessing(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(InnerMergeIteratorDataRaceInstance, |
|
|
|
|
|
|
|
DBIterWithMergeIterTest, ::testing::Bool()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace rocksdb
|
|
|
|
} // namespace rocksdb
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char** argv) { |
|
|
|
int main(int argc, char** argv) { |
|
|
|