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

[Feature]: use plain files to store snapshots #16066

Closed
yihuang opened this issue May 9, 2023 · 4 comments · Fixed by #16067
Closed

[Feature]: use plain files to store snapshots #16066

yihuang opened this issue May 9, 2023 · 4 comments · Fixed by #16067

Comments

@yihuang
Copy link
Collaborator

yihuang commented May 9, 2023

Summary

use plain files to store snapshots for easier out-of-band snapshot syncing

Problem Definition

Right now we store the chunks in files, but snapshot metadata is stored in a kv db, change to plain files will make it easier for external tools to manipulate the snapshots, which will be useful when we use local snapshot restorations and sync the snapshots out-of-band.

Proposal

Just use plain files and directories to store snapshots, without kv db.

- snapshots
  - 00000000000008190000-002 # <height>-<format> padding with enough zeroes to keep the ordering
                           # this directory will be very easy to move around.
    - snapshot             # protobuf serialized `abci.RequestOfferSnapshot`
    - chunks
      - 1
      - 2
  • Use os.ReadDir to iterate the snapshots
  • Read the snapshot file to get snapshot metadata
  • Chunk files are the same as before
  • Less performant than kv db, but should be alright since the number of snapshots won't be too big.
@yihuang
Copy link
Collaborator Author

yihuang commented May 9, 2023

A simpler alternative is just a command that import/export the snapshot in a portable format, basically just bundle the Snapshot message together with the chunk files.

@alexanderbez
Copy link
Contributor

@tac0turtle didn't you work on a tool to do this? In any case, I think the proposal makes sense.

@yihuang
Copy link
Collaborator Author

yihuang commented May 10, 2023

there are two caveats though:

  • change existing snapshots directory format, so need to handle the migration.
  • need to be careful of atomicity of the operations, otherwise ListSnapshot could discover an incomplete snapshot.

@yihuang
Copy link
Collaborator Author

yihuang commented May 11, 2023

I'll close this with #16067, it should be good enough for now with these management commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants