Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

Commit

Permalink
Remove misleading log messages when memoryDB is used
Browse files Browse the repository at this point in the history
  • Loading branch information
halfalicious committed Nov 26, 2019
1 parent 3b0a88e commit 92f33b9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
18 changes: 9 additions & 9 deletions libethereum/BlockChain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,11 @@ bool BlockChain::open(fs::path const& _path, WithExisting _we)
catch (db::DatabaseError const& ex)
{
// Determine which database open call failed
auto const dbPath = !m_blocksDB.get() ? db_paths::blocksDatabasePath() : db_paths::extrasDatabasePath();
LOG(m_loggerError) << "Error opening database: " << dbPath;

auto const dbPath =
!m_blocksDB.get() ? db_paths::blocksDatabasePath() : db_paths::extrasDatabasePath();
if (db::isDiskDatabase())
{
LOG(m_loggerError) << "Error occurred when opening database: " << dbPath;
db::DatabaseStatus const dbStatus = *boost::get_error_info<db::errinfo_dbStatusCode>(ex);
if (fs::space(db_paths::chainPath()).available < 1024)
{
Expand All @@ -282,7 +282,8 @@ bool BlockChain::open(fs::path const& _path, WithExisting _we)
}
}

LOG(m_loggerError) << "Unknown error occurred. Exception details: " << ex.what();
LOG(m_loggerError) << "Unknown error occurred when opening database. Exception details: "
<< ex.what();
throw;
}

Expand All @@ -305,8 +306,7 @@ bool BlockChain::open(fs::path const& _path, WithExisting _we)
// database because the extras database format may have changed
m_lastBlockNumber = info(m_lastBlockHash).number();

LOG(m_loggerInfo) << "Opened blockchain database (" << db_paths::chainPath()
<< "). Latest: " << currentHash()
LOG(m_loggerInfo) << "Opened blockchain database. Latest: " << currentHash()
<< (!rebuildNeeded ? "(rebuild not needed)" : "*** REBUILD NEEDED ***");
return rebuildNeeded;
}
Expand Down Expand Up @@ -387,12 +387,12 @@ void BlockChain::rebuild(
BOOST_THROW_EXCEPTION(DatabaseExists());
}
fs::rename(db_paths::extrasDatabasePath(), db_paths::extrasDatabaseTemporaryPath());
std::unique_ptr<db::DatabaseFace> oldExtrasDB(db::DBFactory::create(db_paths::extrasDatabaseTemporaryPath()));
std::unique_ptr<db::DatabaseFace> oldExtrasDB(
db::DBFactory::create(db_paths::extrasDatabaseTemporaryPath()));
m_extrasDB = db::DBFactory::create(db_paths::extrasDatabasePath());

// Open a fresh state DB
Block s = genesisBlock(
State::openDB(db_paths::rootPath().string(), m_genesisHash, WithExisting::Kill));
Block s = genesisBlock(State::openDB(db_paths::rootPath(), m_genesisHash, WithExisting::Kill));

// Clear all memos ready for replay.
m_details.clear();
Expand Down
12 changes: 6 additions & 6 deletions libethereum/State.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,16 @@ OverlayDB State::openDB(fs::path const& _basePath, h256 const& _genesisHash, Wit

try
{
clog(VerbosityTrace, "statedb") << "Opening state database (and creating if not present): "
<< db_paths::stateDatabasePath();
clog(VerbosityTrace, "statedb") << "Opening state database";
std::unique_ptr<db::DatabaseFace> db = db::DBFactory::create(db_paths::stateDatabasePath());
return OverlayDB(std::move(db));
}
catch (boost::exception const& ex)
{
clog(VerbosityError, "statedb")
<< "Error opening state database: " << db_paths::stateDatabasePath();
if (db::isDiskDatabase())
{
clog(VerbosityError, "statedb")
<< "Error opening state database: " << db_paths::stateDatabasePath();
db::DatabaseStatus const dbStatus =
*boost::get_error_info<db::errinfo_dbStatusCode>(ex);
if (fs::space(db_paths::stateDatabasePath()).available < 1024)
Expand All @@ -93,8 +92,9 @@ OverlayDB State::openDB(fs::path const& _basePath, h256 const& _genesisHash, Wit
BOOST_THROW_EXCEPTION(DatabaseAlreadyOpen());
}
}
clog(VerbosityError, "statedb") << "Unknown error encountered. Exception details: "
<< boost::diagnostic_information(ex);
clog(VerbosityError, "statedb")
<< "Unknown error encountered when opening state database. Exception details: "
<< boost::diagnostic_information(ex);
throw;
}
}
Expand Down

0 comments on commit 92f33b9

Please sign in to comment.