Fixed DBCompactionTest.SkipStatsUpdateTest

Summary:
DBCompactionTest.SkipStatsUpdateTest relies on the number
of files opened during the DB::Open process, but the persisting
options file support altered this number and thus makes
DBCompactionTest.SkipStatsUpdateTest in certain environment.

This patch fixed this test failure.

Test Plan: db_compaction_test

Reviewers: igor, sdong, anthony, IslamAbdelRahman

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D50637
main
Yueh-Hsuan Chiang 9 years ago
parent e11f676e34
commit 56245ddcf5
  1. 11
      db/db_compaction_test.cc

@ -239,9 +239,12 @@ TEST_F(DBCompactionTest, SkipStatsUpdateTest) {
env_->random_file_open_counter_.store(0); env_->random_file_open_counter_.store(0);
Reopen(options); Reopen(options);
// As stats-update is disabled, we expect a very low // As stats-update is disabled, we expect a very low number of
// number of random file open. // random file open.
ASSERT_LT(env_->random_file_open_counter_.load(), 5); // Note that this number must be changed accordingly if we change
// the number of files needed to be opened in the DB::Open process.
const int kMaxFileOpenCount = 10;
ASSERT_LT(env_->random_file_open_counter_.load(), kMaxFileOpenCount);
// Repeat the reopen process, but this time we enable // Repeat the reopen process, but this time we enable
// stats-update. // stats-update.
@ -251,7 +254,7 @@ TEST_F(DBCompactionTest, SkipStatsUpdateTest) {
// Since we do a normal stats update on db-open, there // Since we do a normal stats update on db-open, there
// will be more random open files. // will be more random open files.
ASSERT_GT(env_->random_file_open_counter_.load(), 5); ASSERT_GT(env_->random_file_open_counter_.load(), kMaxFileOpenCount);
} }
TEST_F(DBCompactionTest, TestTableReaderForCompaction) { TEST_F(DBCompactionTest, TestTableReaderForCompaction) {

Loading…
Cancel
Save