From 8394742ad9be3890302f3bdd47cf94c3e60c1056 Mon Sep 17 00:00:00 2001 From: Alexey Shekhirin Date: Wed, 24 Jan 2024 13:25:18 +0000 Subject: [PATCH] Revert "feat: add `HeadersTD` static file segment" (#6210) --- bin/reth/src/commands/db/snapshots/mod.rs | 2 -- crates/primitives/src/snapshot/mod.rs | 5 ----- crates/primitives/src/snapshot/segment.rs | 8 ++------ .../storage/provider/src/providers/database/provider.rs | 8 ++------ crates/storage/provider/src/providers/snapshot/manager.rs | 4 +--- 5 files changed, 5 insertions(+), 22 deletions(-) diff --git a/bin/reth/src/commands/db/snapshots/mod.rs b/bin/reth/src/commands/db/snapshots/mod.rs index 83b05d3c4390..72d5a860dd76 100644 --- a/bin/reth/src/commands/db/snapshots/mod.rs +++ b/bin/reth/src/commands/db/snapshots/mod.rs @@ -113,7 +113,6 @@ impl Command { factory.clone(), snap_segments::Receipts::new(*compression, filters), )?, - SnapshotSegment::HeadersTD => todo!(), } } } @@ -146,7 +145,6 @@ impl Command { InclusionFilter::Cuckoo, phf, )?, - SnapshotSegment::HeadersTD => todo!(), } } } diff --git a/crates/primitives/src/snapshot/mod.rs b/crates/primitives/src/snapshot/mod.rs index 139d82a5b1ce..bbfcec1d2885 100644 --- a/crates/primitives/src/snapshot/mod.rs +++ b/crates/primitives/src/snapshot/mod.rs @@ -18,9 +18,6 @@ pub struct HighestSnapshots { /// Highest snapshotted block of headers, inclusive. /// If [`None`], no snapshot is available. pub headers: Option, - /// Highest snapshotted block of headers total difficulty, inclusive. - /// If [`None`], no snapshot is available. - pub headers_td: Option, /// Highest snapshotted block of receipts, inclusive. /// If [`None`], no snapshot is available. pub receipts: Option, @@ -34,7 +31,6 @@ impl HighestSnapshots { pub fn highest(&self, segment: SnapshotSegment) -> Option { match segment { SnapshotSegment::Headers => self.headers, - SnapshotSegment::HeadersTD => self.headers_td, SnapshotSegment::Transactions => self.transactions, SnapshotSegment::Receipts => self.receipts, } @@ -44,7 +40,6 @@ impl HighestSnapshots { pub fn as_mut(&mut self, segment: SnapshotSegment) -> &mut Option { match segment { SnapshotSegment::Headers => &mut self.headers, - SnapshotSegment::HeadersTD => &mut self.headers_td, SnapshotSegment::Transactions => &mut self.transactions, SnapshotSegment::Receipts => &mut self.receipts, } diff --git a/crates/primitives/src/snapshot/segment.rs b/crates/primitives/src/snapshot/segment.rs index 56525663a2fd..931db830ad70 100644 --- a/crates/primitives/src/snapshot/segment.rs +++ b/crates/primitives/src/snapshot/segment.rs @@ -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, @@ -53,7 +50,6 @@ impl SnapshotSegment { match self { SnapshotSegment::Headers => default_config, - SnapshotSegment::HeadersTD => default_config, SnapshotSegment::Transactions => default_config, SnapshotSegment::Receipts => default_config, } @@ -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(), } } diff --git a/crates/storage/provider/src/providers/database/provider.rs b/crates/storage/provider/src/providers/database/provider.rs index 7436d7510f6a..1180a755cce2 100644 --- a/crates/storage/provider/src/providers/database/provider.rs +++ b/crates/storage/provider/src/providers/database/provider.rs @@ -274,9 +274,7 @@ impl DatabaseProvider { 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) } @@ -323,9 +321,7 @@ impl DatabaseProvider { 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) } diff --git a/crates/storage/provider/src/providers/snapshot/manager.rs b/crates/storage/provider/src/providers/snapshot/manager.rs index 8b71a1c8fed2..5ed22ecf28c4 100644 --- a/crates/storage/provider/src/providers/snapshot/manager.rs +++ b/crates/storage/provider/src/providers/snapshot/manager.rs @@ -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) }