diff options
author | Riccardo Spagni <ric@spagni.net> | 2018-11-26 20:28:49 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2018-11-26 20:28:49 +0200 |
commit | c4fd8ce97e9106cd700622a87a529f14d3fd31c0 (patch) | |
tree | 5f59446f7212406d874bffe3d2f7bec93c6038eb /src/blockchain_db/lmdb | |
parent | Merge pull request #4825 (diff) | |
parent | db_lmdb: error out if the db needs migration in read only mode (diff) | |
download | monero-c4fd8ce97e9106cd700622a87a529f14d3fd31c0.tar.xz |
Merge pull request #4830
dffec258 db_lmdb: error out if the db needs migration in read only mode (moneromooo-monero)
Diffstat (limited to 'src/blockchain_db/lmdb')
-rw-r--r-- | src/blockchain_db/lmdb/db_lmdb.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp index ea3638a85..30fdbc1d8 100644 --- a/src/blockchain_db/lmdb/db_lmdb.cpp +++ b/src/blockchain_db/lmdb/db_lmdb.cpp @@ -1350,6 +1350,15 @@ void BlockchainLMDB::open(const std::string& filename, const int db_flags) #if VERSION > 0 else if (db_version < VERSION) { + if (mdb_flags & MDB_RDONLY) + { + txn.abort(); + mdb_env_close(m_env); + m_open = false; + MFATAL("Existing lmdb database needs to be converted, which cannot be done on a read-only database."); + MFATAL("Please run monerod once to convert the database."); + return; + } // 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. |