feat: add StaticFileSegment::StorageChangeSets#20896
Conversation
3154581 to
010ded8
Compare
| fn storage_changeset_count(&self) -> ProviderResult<usize> { | ||
| let mut count = 0; | ||
|
|
||
| let static_files = iter_static_files(&self.path).map_err(ProviderError::other)?; |
There was a problem hiding this comment.
there should be a better way rather than read from disk again
| tracing::trace!(block_number, "Writing block change"); | ||
| // sort changes by address. | ||
| storage_changes.par_sort_unstable_by_key(|a| a.address); | ||
| let mut changeset = Vec::new(); |
There was a problem hiding this comment.
could we call with_capacity here
There was a problem hiding this comment.
yep now uses with_capacity
There was a problem hiding this comment.
would like to review again once conflicts are in - but it seems to me that we might have some perf impact, because instead of just iterating over the _range, we're collecting it
unsure if there is a better way to handle it tho, or if it's even a significant impact
dfa7e37 to
d22056d
Compare
| if self.cached_storage_settings().storage_changesets_in_static_files { | ||
| self.static_file_provider.storage_changesets_range(range) |
There was a problem hiding this comment.
i think it makes sense,
but we do it differently on account_changesets_range :
reth/crates/storage/provider/src/providers/database/provider.rs
Lines 1368 to 1398 in d22056d
unsure
There was a problem hiding this comment.
I prefer this way of doing it, I think we should rely on storage settings as the source of truth for where we should be checking, and not have the other checks for highest static files
d8b739c to
146006b
Compare
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
Footnotes
|
…ic files The storage changeset static file feature (PR #20896) added routing but forgot to add write_storage_changesets to StateWriteConfig. This caused storage changesets to be written twice when static files were enabled: once via write_blocks_data and again via write_state_reverts. - Add write_storage_changesets field to StateWriteConfig - Pass sf_ctx.write_storage_changesets to the config in save_blocks - Guard storage changeset writes in write_state_reverts with the config - Remove stale workaround comments from RocksDB tests Amp-Thread-ID: https://ampcode.com/threads/T-019bfe6a-bf5e-7207-851a-b05585d255b6
Adds storage changeset static files, which re-use the changeset offsets introduced in #18882
The entries are sorted by address and key rather than just address.
Adds support with the
--static-files.storage-change-setsflagCloses RETH-174