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

snapshot dir to and from archive #30590

Conversation

xiangzhu70
Copy link
Contributor

@xiangzhu70 xiangzhu70 commented Mar 4, 2023

Problem

The current path of bank in memory <-> archive is complicated. To build an archive, some info is from file system (snapshot file, account files in operation path), some is from memory (status cache). For fast boot, we now have the complete snapshot info in the snapshot directory (PR #28745 split PRs). In the -> bank direction, we can construct a bank from only the files. In the -> archive direction, we can now build the archive with only the files, without the need of any data structures in memory.

So it is now possible to break the bank in memory <-> archive path into two independent paths as
memory <-> snapshot dir <-> archive with clean logic separation.
In memory <-> snapshot dir, the information goes between memory data structures and files, and there is no archiving logic involved;
In snapshot dir <-> archive, the information goes between archive and files, there is no data structure in memory involved.

With this, the code can be much simpler. No more need for those intermediate data structures such SnapshotPackage, AccountsPackage.

Summary of Changes

Added the following functions and test.

fn bank_snapshot_dir_to_archive
This creates an archive with full info from the snapshot directory, so it has a different content format. A new snapshot archive version should be defined.

fn unarchive_to_snapshot_dir

test test_roundtrip_snapshot_dir_to_and_from_archive

Open issues:
This new archive has a different content structure, with meta files included. Should we define a new snapshot version? It is actually more about the archive version, not the snapshot itself.

Fixes #

@github-actions github-actions bot added the stale [bot only] Added to stale content; results in auto-close after a week. label Mar 21, 2023
@github-actions github-actions bot closed this Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale [bot only] Added to stale content; results in auto-close after a week.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant