Skip to content

Commit

Permalink
Revert "feat: add HeadersTD static file segment" (#6210)
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhirin committed Jan 24, 2024
1 parent 02d01ac commit 8394742
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 22 deletions.
2 changes: 0 additions & 2 deletions bin/reth/src/commands/db/snapshots/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ impl Command {
factory.clone(),
snap_segments::Receipts::new(*compression, filters),
)?,
SnapshotSegment::HeadersTD => todo!(),
}
}
}
Expand Down Expand Up @@ -146,7 +145,6 @@ impl Command {
InclusionFilter::Cuckoo,
phf,
)?,
SnapshotSegment::HeadersTD => todo!(),
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions crates/primitives/src/snapshot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ pub struct HighestSnapshots {
/// Highest snapshotted block of headers, inclusive.
/// If [`None`], no snapshot is available.
pub headers: Option<BlockNumber>,
/// Highest snapshotted block of headers total difficulty, inclusive.
/// If [`None`], no snapshot is available.
pub headers_td: Option<BlockNumber>,
/// Highest snapshotted block of receipts, inclusive.
/// If [`None`], no snapshot is available.
pub receipts: Option<BlockNumber>,
Expand All @@ -34,7 +31,6 @@ impl HighestSnapshots {
pub fn highest(&self, segment: SnapshotSegment) -> Option<BlockNumber> {
match segment {
SnapshotSegment::Headers => self.headers,
SnapshotSegment::HeadersTD => self.headers_td,
SnapshotSegment::Transactions => self.transactions,
SnapshotSegment::Receipts => self.receipts,
}
Expand All @@ -44,7 +40,6 @@ impl HighestSnapshots {
pub fn as_mut(&mut self, segment: SnapshotSegment) -> &mut Option<BlockNumber> {
match segment {
SnapshotSegment::Headers => &mut self.headers,
SnapshotSegment::HeadersTD => &mut self.headers_td,
SnapshotSegment::Transactions => &mut self.transactions,
SnapshotSegment::Receipts => &mut self.receipts,
}
Expand Down
8 changes: 2 additions & 6 deletions crates/primitives/src/snapshot/segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,8 @@ use strum::{AsRefStr, EnumIter, EnumString};
/// Segment of the data that can be snapshotted.
pub enum SnapshotSegment {
#[strum(serialize = "headers")]
/// Snapshot segment responsible for the `CanonicalHeaders`, `Headers` tables.
/// Snapshot segment responsible for the `CanonicalHeaders`, `Headers`, `HeaderTD` tables.
Headers,
#[strum(serialize = "headerstd")]
/// Snapshot segment responsible for the `HeaderTD` tables.
HeadersTD,
#[strum(serialize = "transactions")]
/// Snapshot segment responsible for the `Transactions` table.
Transactions,
Expand All @@ -53,7 +50,6 @@ impl SnapshotSegment {

match self {
SnapshotSegment::Headers => default_config,
SnapshotSegment::HeadersTD => default_config,
SnapshotSegment::Transactions => default_config,
SnapshotSegment::Receipts => default_config,
}
Expand Down Expand Up @@ -186,7 +182,7 @@ impl SegmentHeader {
/// Returns the row offset which depends on whether the segment is block or transaction based.
pub fn start(&self) -> u64 {
match self.segment {
SnapshotSegment::Headers | SnapshotSegment::HeadersTD => self.block_start(),
SnapshotSegment::Headers => self.block_start(),
SnapshotSegment::Transactions | SnapshotSegment::Receipts => self.tx_start(),
}
}
Expand Down
8 changes: 2 additions & 6 deletions crates/storage/provider/src/providers/database/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,7 @@ impl<TX: DbTx> DatabaseProvider<TX> {
if let Some(snapshot_provider) = &self.snapshot_provider {
// If there is, check the maximum block or transaction number of the segment.
if let Some(snapshot_upper_bound) = match segment {
SnapshotSegment::Headers | SnapshotSegment::HeadersTD => {
snapshot_provider.get_highest_snapshot_block(segment)
}
SnapshotSegment::Headers => snapshot_provider.get_highest_snapshot_block(segment),
SnapshotSegment::Transactions | SnapshotSegment::Receipts => {
snapshot_provider.get_highest_snapshot_tx(segment)
}
Expand Down Expand Up @@ -323,9 +321,7 @@ impl<TX: DbTx> DatabaseProvider<TX> {
if let Some(provider) = &self.snapshot_provider {
// If there is, check the maximum block or transaction number of the segment.
let snapshot_upper_bound = match segment {
SnapshotSegment::Headers | SnapshotSegment::HeadersTD => {
provider.get_highest_snapshot_block(segment)
}
SnapshotSegment::Headers => provider.get_highest_snapshot_block(segment),
SnapshotSegment::Transactions | SnapshotSegment::Receipts => {
provider.get_highest_snapshot_tx(segment)
}
Expand Down
4 changes: 1 addition & 3 deletions crates/storage/provider/src/providers/snapshot/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,7 @@ impl SnapshotProvider {
P: FnMut(&T) -> bool,
{
let get_provider = |start: u64| match segment {
SnapshotSegment::Headers | SnapshotSegment::HeadersTD => {
self.get_segment_provider_from_block(segment, start, None)
}
SnapshotSegment::Headers => self.get_segment_provider_from_block(segment, start, None),
SnapshotSegment::Transactions | SnapshotSegment::Receipts => {
self.get_segment_provider_from_transaction(segment, start, None)
}
Expand Down

0 comments on commit 8394742

Please sign in to comment.