fixup! Throw error when params don't match with previous run
This commit is contained in:
parent
00ce8d9572
commit
04fafebfa6
@ -221,32 +221,33 @@ impl<E: EthSpec> HotColdDB<E, LevelDB<E>, LevelDB<E>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let blob_info = db.load_blob_info()?;
|
let blob_info = db.load_blob_info()?;
|
||||||
let (open_blobs_db, path) = match (&blob_info, blobs_db_path) {
|
let open_blobs_db = match (&blob_info, &blobs_db_path) {
|
||||||
(Some(blob_info), Some(path)) => {
|
(Some(blob_info), Some(_)) => {
|
||||||
if blob_info.blobs_db {
|
if blob_info.blobs_db {
|
||||||
(true, path)
|
true
|
||||||
} else {
|
} else {
|
||||||
return Err(HotColdDBError::BlobsPreviouslyInDefaultStore.into());
|
return Err(HotColdDBError::BlobsPreviouslyInDefaultStore.into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(None, Some(path)) => (true, path),
|
(None, Some(_)) => true,
|
||||||
(Some(_), None) => return Err(HotColdDBError::MissingPathToBlobsDatabase.into()),
|
(Some(_), None) => return Err(HotColdDBError::MissingPathToBlobsDatabase.into()),
|
||||||
(None, None) => (false, cold_path.to_path_buf()),
|
(None, None) => false,
|
||||||
};
|
};
|
||||||
|
|
||||||
let new_blob_info = if open_blobs_db {
|
if let Some(path) = blobs_db_path {
|
||||||
db.blobs_db = Some(LevelDB::open(path.as_path())?);
|
let new_blob_info = if open_blobs_db {
|
||||||
Some(BlobInfo { blobs_db: true })
|
db.blobs_db = Some(LevelDB::open(path.as_path())?);
|
||||||
} else {
|
Some(BlobInfo { blobs_db: true })
|
||||||
Some(BlobInfo { blobs_db: false })
|
} else {
|
||||||
};
|
Some(BlobInfo { blobs_db: false })
|
||||||
|
};
|
||||||
db.compare_and_set_blob_info_with_write(blob_info, new_blob_info)?;
|
db.compare_and_set_blob_info_with_write(blob_info, new_blob_info)?;
|
||||||
info!(
|
info!(
|
||||||
db.log,
|
db.log,
|
||||||
"Blobs DB initialized";
|
"Blobs DB initialized";
|
||||||
"path" => ?path
|
"path" => ?path
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// 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.
|
||||||
|
Loading…
Reference in New Issue
Block a user