Fix unit tests errors

Summary: Those were introduced with 2fb1fea30f because the flushing behavior changed when max_background_flushes is > 0.

Test Plan: make check

Reviewers: ljin, yhchiang, sdong

Reviewed By: sdong

Subscribers: leveldb

Differential Revision: https://reviews.facebook.net/D23577
main
Igor Canadi 10 years ago
parent 51af7c326c
commit 90b8c07b48
  1. 4
      db/corruption_test.cc
  2. 29
      db/db_test.cc
  3. 1
      db/deletefile_test.cc
  4. 1
      tools/reduce_levels_test.cc

@ -332,6 +332,9 @@ TEST(CorruptionTest, CorruptedDescriptor) {
}
TEST(CorruptionTest, CompactionInputError) {
Options options;
options.max_background_flushes = 0;
Reopen(&options);
Build(10);
DBImpl* dbi = reinterpret_cast<DBImpl*>(db_);
dbi->TEST_FlushMemTable();
@ -351,6 +354,7 @@ TEST(CorruptionTest, CompactionInputErrorParanoid) {
options.paranoid_checks = true;
options.write_buffer_size = 131072;
options.max_write_buffer_number = 2;
options.max_background_flushes = 0;
Reopen(&options);
DBImpl* dbi = reinterpret_cast<DBImpl*>(db_);

@ -1325,6 +1325,7 @@ TEST(DBTest, IndexAndFilterBlocksOfNewTableAddedToCache) {
TEST(DBTest, GetPropertiesOfAllTablesTest) {
Options options = CurrentOptions();
options.max_background_flushes = 0;
Reopen(&options);
// Create 4 tables
for (int table = 0; table < 4; ++table) {
@ -1520,7 +1521,10 @@ TEST(DBTest, GetPicksCorrectFile) {
TEST(DBTest, GetEncountersEmptyLevel) {
do {
CreateAndReopenWithCF({"pikachu"});
Options options = CurrentOptions();
options.max_background_flushes = 0;
options.disableDataSync = true;
CreateAndReopenWithCF({"pikachu"}, &options);
// Arrange for the following to happen:
// * sstable A in level 0
// * nothing in level 1
@ -5124,7 +5128,9 @@ TEST(DBTest, Snapshot) {
TEST(DBTest, HiddenValuesAreRemoved) {
do {
CreateAndReopenWithCF({"pikachu"});
Options options = CurrentOptions();
options.max_background_flushes = 0;
CreateAndReopenWithCF({"pikachu"}, &options);
Random rnd(301);
FillLevels("a", "z", 1);
@ -5215,7 +5221,9 @@ TEST(DBTest, CompactBetweenSnapshots) {
}
TEST(DBTest, DeletionMarkers1) {
CreateAndReopenWithCF({"pikachu"});
Options options = CurrentOptions();
options.max_background_flushes = 0;
CreateAndReopenWithCF({"pikachu"}, &options);
Put(1, "foo", "v1");
ASSERT_OK(Flush(1));
const int last = CurrentOptions().max_mem_compaction_level;
@ -5250,7 +5258,9 @@ TEST(DBTest, DeletionMarkers1) {
}
TEST(DBTest, DeletionMarkers2) {
CreateAndReopenWithCF({"pikachu"});
Options options = CurrentOptions();
options.max_background_flushes = 0;
CreateAndReopenWithCF({"pikachu"}, &options);
Put(1, "foo", "v1");
ASSERT_OK(Flush(1));
const int last = CurrentOptions().max_mem_compaction_level;
@ -5279,7 +5289,9 @@ TEST(DBTest, DeletionMarkers2) {
TEST(DBTest, OverlapInLevel0) {
do {
CreateAndReopenWithCF({"pikachu"});
Options options = CurrentOptions();
options.max_background_flushes = 0;
CreateAndReopenWithCF({"pikachu"}, &options);
int tmp = CurrentOptions().max_mem_compaction_level;
ASSERT_EQ(tmp, 2) << "Fix test to match config";
@ -5457,7 +5469,9 @@ TEST(DBTest, CustomComparator) {
}
TEST(DBTest, ManualCompaction) {
CreateAndReopenWithCF({"pikachu"});
Options options = CurrentOptions();
options.max_background_flushes = 0;
CreateAndReopenWithCF({"pikachu"}, &options);
ASSERT_EQ(dbfull()->MaxMemCompactionLevel(), 2)
<< "Need to update this test to match kMaxMemCompactLevel";
@ -5495,6 +5509,7 @@ TEST(DBTest, ManualCompaction) {
if (iter == 0) {
Options options = CurrentOptions();
options.max_background_flushes = 0;
options.num_levels = 3;
options.create_if_missing = true;
DestroyAndReopen(&options);
@ -5594,6 +5609,7 @@ TEST(DBTest, DBOpen_Options) {
TEST(DBTest, DBOpen_Change_NumLevels) {
Options opts;
opts.create_if_missing = true;
opts.max_background_flushes = 0;
DestroyAndReopen(&opts);
ASSERT_TRUE(db_ != nullptr);
CreateAndReopenWithCF({"pikachu"}, &opts);
@ -5777,6 +5793,7 @@ TEST(DBTest, ManifestWriteError) {
options.env = env_;
options.create_if_missing = true;
options.error_if_exists = false;
options.max_background_flushes = 0;
DestroyAndReopen(&options);
ASSERT_OK(Put("foo", "bar"));
ASSERT_EQ("bar", Get("foo"));

@ -34,6 +34,7 @@ class DeleteFileTest {
DeleteFileTest() {
db_ = nullptr;
env_ = Env::Default();
options_.max_background_flushes = 0;
options_.write_buffer_size = 1024*1024*1000;
options_.target_file_size_base = 1024*1024*1000;
options_.max_bytes_for_level_base = 1024*1024*1000;

@ -76,6 +76,7 @@ Status ReduceLevelTest::OpenDB(bool create_if_missing, int num_levels,
opt.num_levels = num_levels;
opt.create_if_missing = create_if_missing;
opt.max_mem_compaction_level = mem_table_compact_level;
opt.max_background_flushes = 0;
rocksdb::Status st = rocksdb::DB::Open(opt, dbname_, &db_);
if (!st.ok()) {
fprintf(stderr, "Can't open the db:%s\n", st.ToString().c_str());

Loading…
Cancel
Save