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

rework prune rewrite with iterators #3568

Merged
merged 2 commits into from
Feb 19, 2021

Conversation

antiochp
Copy link
Member

This PR refactors the handling of pos_to_rm when pruning during compaction.
We used to pass a slice &[u64] around and this has been reworked to accept an IntoIterator<Item = u64>.
This allows us to avoid collect() in various places with intermediate memory allocation.

Split save_prune() into two functions for flexibility so we can pass an iterator into the earlier write_tmp_pruned() without needing &mut self (as the iterator passed in has a reference to immutable self).

@antiochp
Copy link
Member Author

This is purely a refactor. We have decent test coverage. Testing locally to ensure we can still prune/compact successfully.
Will merge if local testing is good.

@antiochp
Copy link
Member Author

20210219 11:37:56.842 DEBUG grin_chain::txhashset::txhashset - txhashset: starting compaction...
20210219 11:38:23.665 DEBUG grin_chain::txhashset::txhashset - txhashset: check_compact output mmr backend...
20210219 11:38:26.931 DEBUG grin_chain::txhashset::txhashset - txhashset: check_compact rangeproof mmr backend...
20210219 11:38:31.452 DEBUG grin_chain::txhashset::txhashset - txhashset: ... compaction finished

@antiochp antiochp merged commit 5092652 into mimblewimble:master Feb 19, 2021
@antiochp antiochp deleted the iterators_for_prune_file branch February 19, 2021 11:59
antiochp added a commit to antiochp/grin that referenced this pull request Feb 22, 2021
antiochp added a commit that referenced this pull request Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant