diff --git a/ethcore/src/migrations/state/v7.rs b/ethcore/src/migrations/state/v7.rs index 88c7c8437..15b457d32 100644 --- a/ethcore/src/migrations/state/v7.rs +++ b/ethcore/src/migrations/state/v7.rs @@ -61,8 +61,9 @@ fn attempt_migrate(mut key_h: H256, val: &[u8]) -> Option { } } -/// Version for `ArchiveDB`. -pub struct ArchiveV7; +/// Version for ArchiveDB. +#[derive(Default)] +pub struct ArchiveV7(usize); impl SimpleMigration for ArchiveV7 { fn version(&self) -> u32 { @@ -70,6 +71,12 @@ impl SimpleMigration for ArchiveV7 { } fn simple_migrate(&mut self, key: Vec, value: Vec) -> Option<(Vec, Vec)> { + self.0 += 1; + if self.0 == 100_000 { + self.0 = 0; + flush!("."); + } + if key.len() != 32 { // metadata key, ignore. return Some((key, value)); @@ -228,7 +235,14 @@ impl Migration for OverlayRecentV7 { _ => return Err(Error::MigrationImpossible), // missing or wrong version } + let mut count = 0; for (key, value) in source.iter() { + count += 1; + if count == 100_000 { + count = 0; + flush!("."); + } + let mut key = key.into_vec(); if key.len() == 32 { let key_h = H256::from_slice(&key[..]); diff --git a/parity/migration.rs b/parity/migration.rs index 853cb6e35..ff0a6b0ee 100644 --- a/parity/migration.rs +++ b/parity/migration.rs @@ -157,7 +157,7 @@ fn extras_database_migrations() -> Result { fn state_database_migrations(pruning: Algorithm) -> Result { let mut manager = MigrationManager::new(default_migration_settings()); let res = match pruning { - Algorithm::Archive => manager.add_migration(migrations::state::ArchiveV7), + Algorithm::Archive => manager.add_migration(migrations::state::ArchiveV7::default()), Algorithm::OverlayRecent => manager.add_migration(migrations::state::OverlayRecentV7::default()), _ => die!("Unsupported pruning method for migration. Delete DB and resync"), };