Skip to content
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

core, ethdb, tests, trie: introduce database snapshot #24486

Merged
merged 1 commit into from
Mar 10, 2022

Conversation

rjl493456442
Copy link
Member

@rjl493456442 rjl493456442 commented Mar 1, 2022

This PR introduce a new API for ethdb, the database snapshot.

It can happen that we want to get the specified version of the data from the database,
to be more specific, retrieve the data from the specified disk snapshot.

Right now this feature is unneeded since basically all data in disk have a unique identifier.
However, when we switch to path-based state scheme, this feature is required, for example:

  • we want to trace block at height N, the disk state is at N + 100
  • we need to rewind the disk state to height N-1 by applying the reverse diffs
  • In the same time, the disk state is mutated by chain by pushing the new version state
  • the trace state has these requirements:
    • state reverts should not affect the live state
    • the live state changes should not affect the trace state

In order to achieve these requirements, we can build a mirror disk state with disk snapshot,
apply the reverse diffs on the top, save these reverts in the disk temporary area, to provide
a consistent view of state and eventually drop all the temporary state reverts and release
the disk snapshot when tracing is finished.

This PR intents to be merged separately.

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@holiman holiman added this to the 1.10.17 milestone Mar 8, 2022
@holiman holiman merged commit 8c8a9e5 into ethereum:master Mar 10, 2022
sidhujag pushed a commit to syscoin/go-ethereum that referenced this pull request Mar 11, 2022
JacekGlen pushed a commit to JacekGlen/go-ethereum that referenced this pull request May 26, 2022
cp-wjhan pushed a commit to cp-yoonjin/go-wemix that referenced this pull request Nov 16, 2022
@s1na s1na mentioned this pull request Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants