From 25c2f7e7fded46792e4e39f60902f8f2a8a8ffee Mon Sep 17 00:00:00 2001 From: rakita Date: Wed, 23 Sep 2020 13:49:25 +0200 Subject: [PATCH] Dont upgrade for old versions of DB (#54) --- parity/db/rocksdb/migration.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/parity/db/rocksdb/migration.rs b/parity/db/rocksdb/migration.rs index bc55bd199..73ea1f6c7 100644 --- a/parity/db/rocksdb/migration.rs +++ b/parity/db/rocksdb/migration.rs @@ -48,6 +48,8 @@ pub const TO_V12: ChangeColumns = ChangeColumns { const DEFAULT_VERSION: u32 = 5; /// Current version of database models. const CURRENT_VERSION: u32 = 16; +/// Until this version please use upgrade tool. +const USE_MIGRATION_TOOL: u32 = 15; /// A version of database at which blooms-db was introduced const BLOOMS_DB_VERSION: u32 = 13; /// Defines how many items are migrated to the new version of database at once. @@ -64,6 +66,8 @@ pub enum Error { FutureDBVersion, /// Migration is not possible. MigrationImpossible, + /// For old versions use external migration tool + UseMigrationTool, /// Blooms-db migration error. BloomsDB(ethcore::error::Error), /// Migration was completed succesfully, @@ -77,7 +81,8 @@ impl Display for Error { Error::UnknownDatabaseVersion => "Current database version cannot be read".into(), Error::FutureDBVersion => "Database was created with newer client version. Upgrade your client or delete DB and resync.".into(), Error::MigrationImpossible => format!("Database migration to version {} is not possible.", CURRENT_VERSION), - Error::BloomsDB(ref err) => format!("blooms-db migration error: {}", err), + Error::BloomsDB(ref err) => format!("blooms-db migration error: {}", err), + Error::UseMigrationTool => "For db versions 15 and lower (v2.5.13=>13, 2.7.2=>14, v3.0.1=>15) please use upgrade db tool to manually upgrade db: https://github.com/openethereum/3.1-db-upgrade-tool".into(), Error::Io(ref err) => format!("Unexpected io error on DB migration: {}.", err), }; @@ -219,6 +224,10 @@ pub fn migrate(path: &Path, compaction_profile: &DatabaseCompactionProfile) -> R return Ok(()); } + if version <= USE_MIGRATION_TOOL { + return Err(Error::UseMigrationTool); + } + let db_path = consolidated_database_path(path); // Further migrations