mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
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:
@@ -1765,10 +1765,13 @@ void CheckConsistencyCommand::Help(string& ret) {
|
||||
|
||||
void CheckConsistencyCommand::DoCommand() {
|
||||
Options opt = PrepareOptionsForOpenDB();
|
||||
opt.paranoid_checks = true;
|
||||
if (!exec_state_.IsNotStarted()) {
|
||||
return;
|
||||
}
|
||||
Status st = DB::CheckConsistency(opt, db_path_);
|
||||
DB* db;
|
||||
Status st = DB::OpenForReadOnly(opt, db_path_, &db, false);
|
||||
delete db;
|
||||
if (st.ok()) {
|
||||
fprintf(stdout, "OK\n");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user