double leveldb repair

This commit is contained in:
proller 2016-09-13 03:52:31 +09:30
parent a90f5d538f
commit ea7245d1cb
2 changed files with 16 additions and 1 deletions

View File

@ -42,8 +42,21 @@ bool KeyValueStorage::open() {
std::lock_guard<Mutex> lock(mutex);
error = status.ToString();
errorstream<< "Trying to repair database ["<<error<<"]"<<std::endl;
status = leveldb::RepairDB(fullpath, options);
try {
status = leveldb::RepairDB(fullpath, options);
} catch (std::exception &e) {
errorstream<< "First repair exception ["<<e.what()<<"]"<<std::endl;
auto options_repair = options;
options_repair.paranoid_checks = true;
try {
status = leveldb::RepairDB(fullpath, options_repair);
} catch (std::exception &e) {
errorstream<< "Second repair exception ["<<e.what()<<"]"<<std::endl;
}
}
if (!status.ok()) {
error = status.ToString();
errorstream<< "Repair fail ["<<error<<"]"<<std::endl;
db = nullptr;
return true;
}

View File

@ -48,6 +48,8 @@ $0 --build_name="_touch_asan" --cmake_touchscreen=1 --cmake_add="-DIRRLICHT_INCL
# sometimes *san + debug doesnt work with leveldb
$0 --cmake_leveldb=0
#or buid and use custom leveldb
$0 --cmake_add="-DLEVELDB_INCLUDE_DIR=../../leveldb/include -DLEVELDB_LIBRARY=../../leveldb/out-static/libleveldb.a"
#if you have installed Intel(R) VTune(TM) Amplifier
$0 play_vtune --vtune_gui=1