Skip to content

Commit

Permalink
parity: fix db path when migrating to blooms db (openethereum#8975)
Browse files Browse the repository at this point in the history
  • Loading branch information
andresilva authored and 5chdn committed Jun 28, 2018
1 parent ac3a706 commit 47ff3a9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions parity/db/rocksdb/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ fn consolidated_database_migrations(compaction_profile: &CompactionProfile) -> R
}

/// Migrates database at given position with given migration rules.
fn migrate_database(version: u32, db_path: PathBuf, mut migrations: MigrationManager) -> Result<(), Error> {
fn migrate_database(version: u32, db_path: &Path, mut migrations: MigrationManager) -> Result<(), Error> {
// check if migration is needed
if !migrations.is_needed(version) {
return Ok(())
Expand Down Expand Up @@ -216,10 +216,12 @@ pub fn migrate(path: &Path, compaction_profile: &DatabaseCompactionProfile) -> R
return Ok(())
}

let db_path = consolidated_database_path(path);

// Further migrations
if version < CURRENT_VERSION && exists(&consolidated_database_path(path)) {
if version < CURRENT_VERSION && exists(&db_path) {
println!("Migrating database from version {} to {}", version, CURRENT_VERSION);
migrate_database(version, consolidated_database_path(path), consolidated_database_migrations(&compaction_profile)?)?;
migrate_database(version, &db_path, consolidated_database_migrations(&compaction_profile)?)?;

if version < BLOOMS_DB_VERSION {
println!("Migrating blooms to blooms-db...");
Expand All @@ -231,7 +233,7 @@ pub fn migrate(path: &Path, compaction_profile: &DatabaseCompactionProfile) -> R
wal: true,
};

migrate_blooms(path, &db_config).map_err(Error::BloomsDB)?;
migrate_blooms(&db_path, &db_config).map_err(Error::BloomsDB)?;
}

println!("Migration finished");
Expand Down

0 comments on commit 47ff3a9

Please sign in to comment.