|
|
@ -34,7 +34,14 @@ static void EnvShutdown(bool fRemoveLogFiles) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
fDbEnvInit = false; |
|
|
|
fDbEnvInit = false; |
|
|
|
dbenv.close(0); |
|
|
|
try |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
dbenv.close(0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch (const DbException& e) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
printf("EnvShutdown exception: %s (%d)\n", e.what(), e.get_errno()); |
|
|
|
|
|
|
|
} |
|
|
|
DbEnv(0).remove(GetDataDir().c_str(), 0); |
|
|
|
DbEnv(0).remove(GetDataDir().c_str(), 0); |
|
|
|
|
|
|
|
|
|
|
|
if (fRemoveLogFiles) |
|
|
|
if (fRemoveLogFiles) |
|
|
@ -229,7 +236,10 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip) |
|
|
|
CDataStream ssValue; |
|
|
|
CDataStream ssValue; |
|
|
|
int ret = db.ReadAtCursor(pcursor, ssKey, ssValue, DB_NEXT); |
|
|
|
int ret = db.ReadAtCursor(pcursor, ssKey, ssValue, DB_NEXT); |
|
|
|
if (ret == DB_NOTFOUND) |
|
|
|
if (ret == DB_NOTFOUND) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
pcursor->close(); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
else if (ret != 0) |
|
|
|
else if (ret != 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
pcursor->close(); |
|
|
|
pcursor->close(); |
|
|
@ -253,14 +263,11 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip) |
|
|
|
} |
|
|
|
} |
|
|
|
if (fSuccess) |
|
|
|
if (fSuccess) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Db* pdb = mapDb[strFile]; |
|
|
|
db.Close(); |
|
|
|
if (pdb->close(0)) |
|
|
|
CloseDb(strFile); |
|
|
|
fSuccess = false; |
|
|
|
|
|
|
|
if (pdbCopy->close(0)) |
|
|
|
if (pdbCopy->close(0)) |
|
|
|
fSuccess = false; |
|
|
|
fSuccess = false; |
|
|
|
delete pdb; |
|
|
|
|
|
|
|
delete pdbCopy; |
|
|
|
delete pdbCopy; |
|
|
|
mapDb[strFile] = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (fSuccess) |
|
|
|
if (fSuccess) |
|
|
|
{ |
|
|
|
{ |
|
|
|