提交 925f60d3 编写于 作者: H heyongqiang

add a test case to make sure chaning num_levels will fail Summary:

Summary: as subject

Test Plan: db_test

Reviewers: dhruba, MarkCallaghan

Reviewed By: MarkCallaghan

Differential Revision: https://reviews.facebook.net/D6303
上级 321dfdc3
...@@ -1682,6 +1682,28 @@ TEST(DBTest, DBOpen_Options) { ...@@ -1682,6 +1682,28 @@ TEST(DBTest, DBOpen_Options) {
db = NULL; db = NULL;
} }
TEST(DBTest, DBOpen_Change_NumLevels) {
std::string dbname = test::TmpDir() + "/db_change_num_levels";
DestroyDB(dbname, Options());
Options opts;
Status s;
opts.create_if_missing = true;
s = DB::Open(opts, dbname, &db_);
ASSERT_OK(s);
ASSERT_TRUE(db_ != NULL);
db_->Put(WriteOptions(), "a", "123");
db_->Put(WriteOptions(), "b", "234");
db_->CompactRange(NULL, NULL);
delete db_;
db_ = NULL;
opts.create_if_missing = false;
opts.num_levels = 2;
s = DB::Open(opts, dbname, &db_);
ASSERT_TRUE(strstr(s.ToString().c_str(), "Corruption") != NULL);
ASSERT_TRUE(db_ == NULL);
}
// Check that number of files does not grow when we are out of space // Check that number of files does not grow when we are out of space
TEST(DBTest, NoSpace) { TEST(DBTest, NoSpace) {
Options options = CurrentOptions(); Options options = CurrentOptions();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册