From 7e13ce6185d5b2cbae56dc2d037d64bf98eb24c7 Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Mon, 11 Jul 2016 19:39:06 +0200 Subject: [PATCH 1/2] v7 migration progress --- ethcore/src/migrations/state/v7.rs | 16 +++++++++++++++- parity/migration.rs | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ethcore/src/migrations/state/v7.rs b/ethcore/src/migrations/state/v7.rs index 45a5669b2..57f7d97a8 100644 --- a/ethcore/src/migrations/state/v7.rs +++ b/ethcore/src/migrations/state/v7.rs @@ -62,7 +62,8 @@ fn attempt_migrate(mut key_h: H256, val: &[u8]) -> Option { } /// Version for ArchiveDB. -pub struct ArchiveV7; +#[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; + println!("."); + } + 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; + println!("."); + } + 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"), }; From 86df371a727def10fc3ef170026a73a89f383d66 Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Tue, 12 Jul 2016 12:20:43 +0200 Subject: [PATCH 2/2] dots on same line --- ethcore/src/migrations/state/v7.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ethcore/src/migrations/state/v7.rs b/ethcore/src/migrations/state/v7.rs index 57f7d97a8..a69eecb2d 100644 --- a/ethcore/src/migrations/state/v7.rs +++ b/ethcore/src/migrations/state/v7.rs @@ -74,7 +74,7 @@ impl SimpleMigration for ArchiveV7 { self.0 += 1; if self.0 == 100_000 { self.0 = 0; - println!("."); + flush!("."); } if key.len() != 32 { @@ -240,7 +240,7 @@ impl Migration for OverlayRecentV7 { count += 1; if count == 100_000 { count = 0; - println!("."); + flush!("."); } let mut key = key.into_vec();