Skip to content

Commit

Permalink
Add unit test for WAL corruption
Browse files Browse the repository at this point in the history
Summary: Closes facebook#3618

Differential Revision: D7301053

Pulled By: ajkr

fbshipit-source-id: a9dde90caa548c294d03d6386f78428c8536ca14
  • Loading branch information
ajkr authored and facebook-github-bot committed Mar 23, 2018
1 parent 2e3d407 commit 82137f0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions utilities/checkpoint/checkpoint_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,18 @@ TEST_F(CheckpointTest, CheckpointInvalidDirectoryName) {
}
}

TEST_F(CheckpointTest, CheckpointWithParallelWrites) {
// When run with TSAN, this exposes the data race fixed in
// https://github.com/facebook/rocksdb/pull/3603
ASSERT_OK(Put("key1", "val1"));
port::Thread thread([this]() { ASSERT_OK(Put("key2", "val2")); });
Checkpoint* checkpoint;
ASSERT_OK(Checkpoint::Create(db_, &checkpoint));
ASSERT_OK(checkpoint->CreateCheckpoint(snapshot_name_));
delete checkpoint;
thread.join();
}

} // namespace rocksdb

int main(int argc, char** argv) {
Expand Down

0 comments on commit 82137f0

Please sign in to comment.