-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
[wip] Correctly purge zero lamport accounts #7013
Changes from all commits
c6bdaac
206a098
53edd4a
091c2ce
0c21d4f
bdc6cf6
0db6827
f01c60e
e19b093
de90b62
e618b60
6953a55
372aa5f
78bb5c9
719d07d
22443b8
d273b15
4c589c9
bbcfd87
e440ec2
5a5b879
fe1eb8e
244e194
794f45f
c15e019
1e21ede
354f6f0
28b537f
0a48cc7
be4e3fd
f5c77fa
27509b7
0fa3a31
72fca15
646679e
525645a
198be91
b891f59
8b54fba
4c62be8
3fc836c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,6 +151,7 @@ where | |
} | ||
|
||
pub fn add_snapshot<P: AsRef<Path>>(snapshot_path: P, bank: &Bank) -> Result<()> { | ||
trace!("ryoqun saving snapshot"); | ||
bank.purge_zero_lamport_accounts(); | ||
let slot = bank.slot(); | ||
// snapshot_path/slot | ||
|
@@ -211,6 +212,7 @@ pub fn bank_from_archive<P: AsRef<Path>>( | |
snapshot_path: &PathBuf, | ||
snapshot_tar: P, | ||
) -> Result<Bank> { | ||
trace!("ryoqun loading snapshot"); | ||
// Untar the snapshot into a temp directory under `snapshot_config.snapshot_path()` | ||
let unpack_dir = tempfile::tempdir_in(snapshot_path)?; | ||
untar_snapshot_in(&snapshot_tar, &unpack_dir)?; | ||
|
@@ -224,6 +226,7 @@ pub fn bank_from_archive<P: AsRef<Path>>( | |
unpacked_accounts_dir, | ||
)?; | ||
|
||
bank.purge_zero_lamport_accounts(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As discussed, now we both do purge zero lamport accounts when saving and loading snapshots. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In contract to this, this call cannot be omitted for security reasons. |
||
if !bank.verify_snapshot_bank() { | ||
panic!("Snapshot bank failed to verify"); | ||
} | ||
|
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.
Note: We can reduce the frequency of
purge_zero_lamport_accounts
invocations for the performance gains because the invocation is completely optional for creating snapshots other than freeing up some memory consumed by zero-lamport accounts.