From 889a9689c679cd15b196d5047578107da021b84e Mon Sep 17 00:00:00 2001 From: dapplion <35266934+dapplion@users.noreply.github.com> Date: Wed, 25 Dec 2024 13:29:10 +0800 Subject: [PATCH] More logs on migration --- .../src/schema_change/migration_schema_v23.rs | 10 ++++++++++ beacon_node/store/src/hot_cold_store.rs | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/beacon_node/beacon_chain/src/schema_change/migration_schema_v23.rs b/beacon_node/beacon_chain/src/schema_change/migration_schema_v23.rs index 92c6baa257..b82d0684af 100644 --- a/beacon_node/beacon_chain/src/schema_change/migration_schema_v23.rs +++ b/beacon_node/beacon_chain/src/schema_change/migration_schema_v23.rs @@ -50,6 +50,8 @@ pub fn upgrade_to_v23( "Starting hot states migration"; "summaries_count" => state_summaries_dag.summaries_count(), "slots_count" => summaries_by_slot.len(), + "min_slot" => ?summaries_by_slot.first_key_value().map(|(slot, _)| slot), + "max_slot" => ?summaries_by_slot.last_key_value().map(|(slot, _)| slot), ); // Upgrade all hot DB state summaries to the new type: @@ -67,6 +69,14 @@ pub fn upgrade_to_v23( // TODO(hdiff): make sure lowest hot hierarchy config is >= 5 to prevent having to // reconstruct states. let storage_strategy = db.hot_storage_strategy(slot)?; + debug!( + log, + "Migrating state summary"; + "slot" => slot, + "state_root" => ?state_root, + "storage_strategy" => ?storage_strategy, + ); + match storage_strategy { StorageStrategy::DiffFrom(_) | StorageStrategy::Snapshot => { // Load the full state and re-store it as a snapshot or diff. diff --git a/beacon_node/store/src/hot_cold_store.rs b/beacon_node/store/src/hot_cold_store.rs index b51386b059..9ab233c647 100644 --- a/beacon_node/store/src/hot_cold_store.rs +++ b/beacon_node/store/src/hot_cold_store.rs @@ -387,7 +387,12 @@ impl HotColdDB, LevelDB> { "from_version" => schema_version.as_u64(), "to_version" => CURRENT_SCHEMA_VERSION.as_u64(), ); - migrate_schema(db.clone(), schema_version, CURRENT_SCHEMA_VERSION)?; + migrate_schema(db.clone(), schema_version, CURRENT_SCHEMA_VERSION).map_err(|e| { + Error::MigrationError(format!( + "Migrating from {:?} to {:?}: {:?}", + schema_version, CURRENT_SCHEMA_VERSION, e + )) + })?; } else { db.store_schema_version(CURRENT_SCHEMA_VERSION)?; }