Changes for supporting cross functional tests for inplace_update

Summary:
This diff containes the changes to the code and db_test
for supporting cross functional tests for inplace_update

Test Plan: Run XF with inplace_test and also without

Reviewers: igor, sdong

Reviewed By: sdong

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D32367
main
Venkatesh Radhakrishnan 10 years ago
parent 9898f63988
commit dad98dd4ae
  1. 10
      db/db_test.cc
  2. 5
      db/memtable.h

@ -2432,8 +2432,10 @@ TEST(DBTest, IterPrevMaxSkip) {
} }
TEST(DBTest, IterWithSnapshot) { TEST(DBTest, IterWithSnapshot) {
anon::OptionsOverride options_override;
options_override.skip_policy = kSkipNoSnapshot;
do { do {
CreateAndReopenWithCF({"pikachu"}, CurrentOptions()); CreateAndReopenWithCF({"pikachu"}, CurrentOptions(options_override));
ASSERT_OK(Put(1, "key1", "val1")); ASSERT_OK(Put(1, "key1", "val1"));
ASSERT_OK(Put(1, "key2", "val2")); ASSERT_OK(Put(1, "key2", "val2"));
ASSERT_OK(Put(1, "key3", "val3")); ASSERT_OK(Put(1, "key3", "val3"));
@ -8098,9 +8100,11 @@ static bool CompareIterators(int step,
} }
TEST(DBTest, Randomized) { TEST(DBTest, Randomized) {
anon::OptionsOverride options_override;
options_override.skip_policy = kSkipNoSnapshot;
Random rnd(test::RandomSeed()); Random rnd(test::RandomSeed());
do { do {
ModelDB model(CurrentOptions()); ModelDB model(CurrentOptions(options_override));
const int N = 10000; const int N = 10000;
const Snapshot* model_snap = nullptr; const Snapshot* model_snap = nullptr;
const Snapshot* db_snap = nullptr; const Snapshot* db_snap = nullptr;
@ -8170,7 +8174,7 @@ TEST(DBTest, Randomized) {
if (db_snap != nullptr) db_->ReleaseSnapshot(db_snap); if (db_snap != nullptr) db_->ReleaseSnapshot(db_snap);
auto options = CurrentOptions(); auto options = CurrentOptions(options_override);
Reopen(options); Reopen(options);
ASSERT_TRUE(CompareIterators(step, &model, db_, nullptr, nullptr)); ASSERT_TRUE(CompareIterators(step, &model, db_, nullptr, nullptr));

@ -196,7 +196,10 @@ class MemTable {
} }
// return true if the current MemTableRep supports snapshots. // return true if the current MemTableRep supports snapshots.
bool IsSnapshotSupported() const { return table_->IsSnapshotSupported(); } // inplace update prevents snapshots,
bool IsSnapshotSupported() const {
return table_->IsSnapshotSupported() && !moptions_.inplace_update_support;
}
// Get the lock associated for the key // Get the lock associated for the key
port::RWMutex* GetLock(const Slice& key); port::RWMutex* GetLock(const Slice& key);

Loading…
Cancel
Save