chore: use UnifiedStorageWriter::commit where possible (#10019)

This commit is contained in:
joshieDo
2024-08-02 15:11:11 +01:00
committed by GitHub
parent f9ad47ed6c
commit 06fbdd98d2
13 changed files with 106 additions and 132 deletions

View File

@ -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(())
}

View File

@ -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()?;
}