aboutsummaryrefslogtreecommitdiff
path: root/src/db.cpp
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2013-03-24 12:59:03 -0700
committerGregory Maxwell <greg@xiph.org>2013-03-24 12:59:03 -0700
commit14c9d116be476d08dd18f2e9f4a8ed251a6bbf79 (patch)
treeeab7b1e3407b166dafe1575ca8e3808a108bea3e /src/db.cpp
parentdfd71bb4509d12c26e630bc671a542ad5bab4945 (diff)
Make explicitly requested salvage operations keep going when there is an error.
In my tests corrupted wallets would often result in BDB dropping an error just due to duplicate records being found, which appears harmless.
Diffstat (limited to 'src/db.cpp')
-rw-r--r--src/db.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/db.cpp b/src/db.cpp
index 94629f3cad..907dba535f 100644
--- a/src/db.cpp
+++ b/src/db.cpp
@@ -167,9 +167,18 @@ bool CDBEnv::Salvage(std::string strFile, bool fAggressive,
Db db(&dbenv, 0);
int result = db.verify(strFile.c_str(), NULL, &strDump, flags);
- if (result != 0)
+ if (result == DB_VERIFY_BAD)
{
- printf("ERROR: db salvage failed\n");
+ printf("Error: Salvage found errors, all data may not be recoverable.\n");
+ if (!fAggressive)
+ {
+ printf("Error: Rerun with aggressive mode to ignore errors and continue.\n");
+ return false;
+ }
+ }
+ if (result != 0 && result != DB_VERIFY_BAD)
+ {
+ printf("ERROR: db salvage failed: %d\n",result);
return false;
}