Skip to content

Commit

Permalink
More logs on migration
Browse files Browse the repository at this point in the history
  • Loading branch information
dapplion committed Dec 25, 2024
1 parent 0a33dcc commit 889a968
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
10 changes: 10 additions & 0 deletions beacon_node/beacon_chain/src/schema_change/migration_schema_v23.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ pub fn upgrade_to_v23<T: BeaconChainTypes>(
"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:
Expand All @@ -67,6 +69,14 @@ pub fn upgrade_to_v23<T: BeaconChainTypes>(
// 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.
Expand Down
7 changes: 6 additions & 1 deletion beacon_node/store/src/hot_cold_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,12 @@ impl<E: EthSpec> HotColdDB<E, LevelDB<E>, LevelDB<E>> {
"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)?;
}
Expand Down

0 comments on commit 889a968

Please sign in to comment.