Reorder loading of db metadata from disk to allow for future changes to schema

This commit is contained in:
Emilia Hane 2023-02-07 11:20:04 +01:00
parent d599e41f3d
commit d7eb9441cf
No known key found for this signature in database
GPG Key ID: E73394F9C09206FA

View File

@ -213,17 +213,6 @@ impl<E: EthSpec> HotColdDB<E, LevelDB<E>, LevelDB<E>> {
); );
} }
if let Some(blob_info) = db.load_blob_info()? {
let oldest_blob_slot = blob_info.oldest_blob_slot;
*db.blob_info.write() = blob_info;
info!(
db.log,
"Blob info loaded from disk";
"oldest_blob_slot" => ?oldest_blob_slot,
);
}
// Ensure that the schema version of the on-disk database matches the software. // Ensure that the schema version of the on-disk database matches the software.
// If the version is mismatched, an automatic migration will be attempted. // If the version is mismatched, an automatic migration will be attempted.
let db = Arc::new(db); let db = Arc::new(db);
@ -239,6 +228,17 @@ impl<E: EthSpec> HotColdDB<E, LevelDB<E>, LevelDB<E>> {
db.store_schema_version(CURRENT_SCHEMA_VERSION)?; db.store_schema_version(CURRENT_SCHEMA_VERSION)?;
} }
if let Some(blob_info) = db.load_blob_info()? {
let oldest_blob_slot = blob_info.oldest_blob_slot;
*db.blob_info.write() = blob_info;
info!(
db.log,
"Blob info loaded from disk";
"oldest_blob_slot" => ?oldest_blob_slot,
);
}
// Ensure that any on-disk config is compatible with the supplied config. // Ensure that any on-disk config is compatible with the supplied config.
if let Some(disk_config) = db.load_config()? { if let Some(disk_config) = db.load_config()? {
db.config.check_compatibility(&disk_config)?; db.config.check_compatibility(&disk_config)?;