db_ldmb: print db version when complaining about incompatibility

This commit is contained in:
moneromooo-monero 2018-06-11 17:54:58 +01:00
parent 25e7a7d96f
commit 2d10830cfb
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
1 changed files with 5 additions and 4 deletions

View File

@ -1306,20 +1306,21 @@ void BlockchainLMDB::open(const std::string& filename, const int db_flags)
auto get_result = mdb_get(txn, m_properties, &k, &v);
if(get_result == MDB_SUCCESS)
{
if (*(const uint32_t*)v.mv_data > VERSION)
const uint32_t db_version = *(const uint32_t*)v.mv_data;
if (db_version > VERSION)
{
MWARNING("Existing lmdb database was made by a later version. We don't know how it will change yet.");
MWARNING("Existing lmdb database was made by a later version (" << db_version << "). We don't know how it will change yet.");
compatible = false;
}
#if VERSION > 0
else if (*(const uint32_t*)v.mv_data < VERSION)
else if (db_version < VERSION)
{
// Note that there was a schema change within version 0 as well.
// See commit e5d2680094ee15889934fe28901e4e133cda56f2 2015/07/10
// We don't handle the old format previous to that commit.
txn.commit();
m_open = true;
migrate(*(const uint32_t *)v.mv_data);
migrate(db_version);
return;
}
#endif