mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
chore: use UnifiedStorageWriter::commit where possible (#10019)
This commit is contained in:
@ -9,7 +9,7 @@ use reth_db_common::{
|
||||
DbTool,
|
||||
};
|
||||
use reth_node_core::args::StageEnum;
|
||||
use reth_provider::{providers::StaticFileWriter, StaticFileProviderFactory};
|
||||
use reth_provider::{writer::UnifiedStorageWriter, StaticFileProviderFactory};
|
||||
use reth_stages::StageId;
|
||||
use reth_static_file_types::{find_fixed_range, StaticFileSegment};
|
||||
|
||||
@ -174,8 +174,7 @@ impl Command {
|
||||
|
||||
tx.put::<tables::StageCheckpoints>(StageId::Finish.to_string(), Default::default())?;
|
||||
|
||||
static_file_provider.commit()?;
|
||||
provider_rw.commit()?;
|
||||
UnifiedStorageWriter::commit_unwind(provider_rw, static_file_provider)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@ -27,8 +27,8 @@ use reth_node_metrics::{
|
||||
version::VersionInfo,
|
||||
};
|
||||
use reth_provider::{
|
||||
ChainSpecProvider, StageCheckpointReader, StageCheckpointWriter, StaticFileProviderFactory,
|
||||
StaticFileWriter,
|
||||
writer::UnifiedStorageWriter, ChainSpecProvider, StageCheckpointReader, StageCheckpointWriter,
|
||||
StaticFileProviderFactory,
|
||||
};
|
||||
use reth_stages::{
|
||||
stages::{
|
||||
@ -272,12 +272,10 @@ impl Command {
|
||||
}
|
||||
|
||||
if self.commit {
|
||||
// For unwinding it makes more sense to commit the database first, since if
|
||||
// this function is interrupted before the static files commit, we can just
|
||||
// truncate the static files according to the
|
||||
// checkpoints on the next start-up.
|
||||
provider_rw.commit()?;
|
||||
provider_factory.static_file_provider().commit()?;
|
||||
UnifiedStorageWriter::commit_unwind(
|
||||
provider_rw,
|
||||
provider_factory.static_file_provider(),
|
||||
)?;
|
||||
provider_rw = provider_factory.provider_rw()?;
|
||||
}
|
||||
}
|
||||
@ -300,8 +298,7 @@ impl Command {
|
||||
provider_rw.save_stage_checkpoint(exec_stage.id(), checkpoint)?;
|
||||
}
|
||||
if self.commit {
|
||||
provider_factory.static_file_provider().commit()?;
|
||||
provider_rw.commit()?;
|
||||
UnifiedStorageWriter::commit(provider_rw, provider_factory.static_file_provider())?;
|
||||
provider_rw = provider_factory.provider_rw()?;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user