-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(snapshots): write to snapshots during BodyStage
#5733
Conversation
This reverts commit b9c51e9.
Co-authored-by: Alexey Shekhirin <a.shekhirin@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I coulf follow this quite well, though I'd like to see more docs in the bodies stage that explains in detail what is happening
let mut next_tx_num = tx_cursor.last()?.map(|(id, _)| id + 1).unwrap_or_default(); | ||
let mut next_tx_num = tx_block_cursor.last()?.map(|(id, _)| id + 1).unwrap_or_default(); | ||
|
||
let snapshot_provider = provider.snapshot_provider().expect("should exist"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, I don't really like this panic.
I guess this is an expect because unreachable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, stages [should] receive a DatabaseProvider
with a SnapshotProvider
083ac14
to
dd749fc
Compare
16e1a2a
to
ead73cc
Compare
ead73cc
to
782f7e3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks ok and we tested it, so let's merge into a feature branch and fix bugs that will pop up later to unblock other PRs building on top of this branch. LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm,
pedantic last nits
@@ -53,7 +53,7 @@ impl Command { | |||
let mut row_indexes = tx_range.clone().collect::<Vec<_>>(); | |||
|
|||
let path: PathBuf = SnapshotSegment::Receipts | |||
.filename_with_configuration(filters, compression, &block_range, &tx_range) | |||
.filename_with_configuration(filters, compression, &block_range) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fewer args good
[self.data_path().into(), self.index_path(), self.offsets_path(), self.config_path()] | ||
{ | ||
if path.exists() { | ||
std::fs::remove_file(path)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use the primitives fs
path::Path, | ||
}; | ||
|
||
/// Size of one offset in bytes. | ||
const OFFSET_SIZE_BYTES: u64 = 8; | ||
|
||
/// Holds a reference or an owned [`NippyJar`]. | ||
#[derive(Debug)] | ||
enum CowJar<'a, H: NippyJarHeader = ()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is Clone so the Cow prefix isn't accurate. though I'm fine this, because it conveys what does
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
Co-authored-by: joshieDo <ranriver@protonmail.com>
Writes
TransactionSignedNoHash
to static files instead ofmdbx
duringBodyStage
.tx_range
from filename #5823SegmentHeader
block range in the*.conf
file is the actual block range (eg. the latest one will have less than 500k blocks), while the filename block range is fixed to the 500k interval. This allows for easier file consistency and querying.SnapshotProviderRW
used by stages to append data. It can also unwind/truncate data when an inconsistency error occurs (eg. node shuts down after a static file commit, but before the database could commit).