mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +00:00
Integrate tracing (#6339)
Tracing Integration
- [reference](5bbf1859e9/projects/project-ideas.md (L297))
- [x] replace slog & log with tracing throughout the codebase
- [x] implement custom crit log
- [x] make relevant changes in the formatter
- [x] replace sloggers
- [x] re-write SSE logging components
cc: @macladson @eserilev
This commit is contained in:
@@ -4,7 +4,6 @@ mod migration_schema_v21;
|
||||
mod migration_schema_v22;
|
||||
|
||||
use crate::beacon_chain::BeaconChainTypes;
|
||||
use slog::Logger;
|
||||
use std::sync::Arc;
|
||||
use store::hot_cold_store::{HotColdDB, HotColdDBError};
|
||||
use store::metadata::{SchemaVersion, CURRENT_SCHEMA_VERSION};
|
||||
@@ -17,7 +16,6 @@ pub fn migrate_schema<T: BeaconChainTypes>(
|
||||
genesis_state_root: Option<Hash256>,
|
||||
from: SchemaVersion,
|
||||
to: SchemaVersion,
|
||||
log: Logger,
|
||||
) -> Result<(), StoreError> {
|
||||
match (from, to) {
|
||||
// Migrating from the current schema version to itself is always OK, a no-op.
|
||||
@@ -25,39 +23,39 @@ pub fn migrate_schema<T: BeaconChainTypes>(
|
||||
// Upgrade across multiple versions by recursively migrating one step at a time.
|
||||
(_, _) if from.as_u64() + 1 < to.as_u64() => {
|
||||
let next = SchemaVersion(from.as_u64() + 1);
|
||||
migrate_schema::<T>(db.clone(), genesis_state_root, from, next, log.clone())?;
|
||||
migrate_schema::<T>(db, genesis_state_root, next, to, log)
|
||||
migrate_schema::<T>(db.clone(), genesis_state_root, from, next)?;
|
||||
migrate_schema::<T>(db, genesis_state_root, next, to)
|
||||
}
|
||||
// Downgrade across multiple versions by recursively migrating one step at a time.
|
||||
(_, _) if to.as_u64() + 1 < from.as_u64() => {
|
||||
let next = SchemaVersion(from.as_u64() - 1);
|
||||
migrate_schema::<T>(db.clone(), genesis_state_root, from, next, log.clone())?;
|
||||
migrate_schema::<T>(db, genesis_state_root, next, to, log)
|
||||
migrate_schema::<T>(db.clone(), genesis_state_root, from, next)?;
|
||||
migrate_schema::<T>(db, genesis_state_root, next, to)
|
||||
}
|
||||
|
||||
//
|
||||
// Migrations from before SchemaVersion(19) are deprecated.
|
||||
//
|
||||
(SchemaVersion(19), SchemaVersion(20)) => {
|
||||
let ops = migration_schema_v20::upgrade_to_v20::<T>(db.clone(), log)?;
|
||||
let ops = migration_schema_v20::upgrade_to_v20::<T>(db.clone())?;
|
||||
db.store_schema_version_atomically(to, ops)
|
||||
}
|
||||
(SchemaVersion(20), SchemaVersion(19)) => {
|
||||
let ops = migration_schema_v20::downgrade_from_v20::<T>(db.clone(), log)?;
|
||||
let ops = migration_schema_v20::downgrade_from_v20::<T>(db.clone())?;
|
||||
db.store_schema_version_atomically(to, ops)
|
||||
}
|
||||
(SchemaVersion(20), SchemaVersion(21)) => {
|
||||
let ops = migration_schema_v21::upgrade_to_v21::<T>(db.clone(), log)?;
|
||||
let ops = migration_schema_v21::upgrade_to_v21::<T>(db.clone())?;
|
||||
db.store_schema_version_atomically(to, ops)
|
||||
}
|
||||
(SchemaVersion(21), SchemaVersion(20)) => {
|
||||
let ops = migration_schema_v21::downgrade_from_v21::<T>(db.clone(), log)?;
|
||||
let ops = migration_schema_v21::downgrade_from_v21::<T>(db.clone())?;
|
||||
db.store_schema_version_atomically(to, ops)
|
||||
}
|
||||
(SchemaVersion(21), SchemaVersion(22)) => {
|
||||
// This migration needs to sync data between hot and cold DBs. The schema version is
|
||||
// bumped inside the upgrade_to_v22 fn
|
||||
migration_schema_v22::upgrade_to_v22::<T>(db.clone(), genesis_state_root, log)
|
||||
migration_schema_v22::upgrade_to_v22::<T>(db.clone(), genesis_state_root)
|
||||
}
|
||||
// Anything else is an error.
|
||||
(_, _) => Err(HotColdDBError::UnsupportedSchemaVersion {
|
||||
|
||||
Reference in New Issue
Block a user