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

delays collect::<Vec<_>> until the very end of erasure recovery #4587

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

behzadnouri
Copy link

Problem

With the updated code, we can retain iterators through the call stack and only do collect::<Vec<_>> at the very end.

Summary of Changes

The commit retains iterators through the call stack and only does collect::<Vec<_>> at the very end of erasure of recovery.

With the updated code, we can retain iterators through the call stack
and only do collect::<Vec<_>> at the very end.
Copy link

@steviez steviez left a comment

Choose a reason for hiding this comment

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

LGTM

merkle::recover(shreds, reed_solomon_cache)?
.map(|shred| Ok(Shred::from(shred?)))
.collect()
let shreds = merkle::recover(shreds, reed_solomon_cache)?;
Copy link

@steviez steviez Jan 23, 2025

Choose a reason for hiding this comment

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

Outside of scope of this PR - I initially thought we might be able to avoid the collect higher in this function and pass an iterator to merkle::recover(). However, it looks like merkle::recover() needs a sorted list and we need to have all the shreds present in order to sort them, so not sure we can do away with that collect after all

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.

2 participants