Sanity check on Open

Summary:
Everytime a client opens a DB, we do a sanity check that:
* checks the existance of all the necessary files
* verifies that file sizes are correct

Some of the code was stolen from https://reviews.facebook.net/D16935

Test Plan: added a unit test

Reviewers: dhruba, haobo, sdong

Reviewed By: dhruba

CC: leveldb

Differential Revision: https://reviews.facebook.net/D17097
This commit is contained in:
Igor Canadi
2014-03-20 14:18:29 -07:00
parent 7981a43274
commit e67241f0b9
7 changed files with 73 additions and 54 deletions

View File

@@ -91,14 +91,6 @@ class DB {
const std::string& name, DB** dbptr,
bool error_if_log_file_exist = false);
// Check the consistency of live files' metadata.
// It will return Corruption Status when a file in manifest
// doesn't actually exist or doesn't match the actual file size.
// Note: This call should be invoked only when the database is
// not already open and serving data.
static Status CheckConsistency(const Options& options,
const std::string& name);
DB() { }
virtual ~DB();