lmdb: Open LMDB file after restoring cache so DBs added from cache have the storage initialized

This commit is contained in:
Martchus 2022-01-25 00:01:59 +01:00
parent 5a66bdc8c2
commit 300f74fb10
1 changed files with 4 additions and 2 deletions

View File

@ -506,6 +506,10 @@ std::size_t ServiceSetup::restoreState()
cerr << Phrases::WarningMessage << "An IO error occurred when restoring cache file \"" << cacheFilePath << "\"." << Phrases::EndFlush; cerr << Phrases::WarningMessage << "An IO error occurred when restoring cache file \"" << cacheFilePath << "\"." << Phrases::EndFlush;
} }
// open LMDB storage
cout << Phrases::InfoMessage << "Opening LMDB file: " << dbPath << " (max DBs: " << maxDbs << ')' << Phrases::EndFlush;
config.initStorage(dbPath.data(), maxDbs);
// restore build actions from JSON file // restore build actions from JSON file
if (!hasBuildActions) { if (!hasBuildActions) {
try { try {
@ -621,8 +625,6 @@ std::size_t ServiceSetup::saveState()
void ServiceSetup::initStorage() void ServiceSetup::initStorage()
{ {
cout << Phrases::InfoMessage << "Opening LMDB file: " << dbPath << " (max DBs: " << maxDbs << ')' << Phrases::EndFlush;
config.initStorage(dbPath.data(), maxDbs);
restoreState(); restoreState();
config.markAllDatabasesToBeDiscarded(); config.markAllDatabasesToBeDiscarded();
} }