forked from solana-labs/solana
-
Notifications
You must be signed in to change notification settings - Fork 321
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
reworks update_completed_data_indexes when inserting shreds #4531
Merged
behzadnouri
merged 1 commit into
anza-xyz:master
from
behzadnouri:bs-update-completed-data-indexes
Jan 24, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think its actually impossible for this array to ever have three
i, j, k
where all i, j, and k areSome(x)
, because theis_last_in_data
check and the lastcompleted_data_indexes.range
check should be mutually exclusive.Might be good for clarity to mention there really are only two entries after the call to
flatten()
, that define a singular rangeThere 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.
hmm, why should it be impossible? 🤔
Lets say the banking-stage creates 3 small consecutive
Vec<Entry>
and passes them down to the shredder each separately.And lets say each of the 3
Vec<Entry>
fits in a single data shred, so the shredder creates 3 separate data shreds each withDATA_COMPLETE_SHRED
flag and consecutive indexes, say, shred index: 20, 21 and 22.Assume that you have already received indices 20 and 22, and they are already inserted in
completed_data_indexes
.At the moment that you receive
new_shred_index == 21
this function should initialize an array with entriesand the function should return 2 ranges:
21..22
and22..23
.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.
@carllin does this make sense?
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.
I think I agree with Behzad here; I worked through an example from a real block as a sanity check. The real, full block has these as
completed_data_indexes
:Imagine that every shred except the one at index 35 has previously been inserted, and we are now inserting 35. This function will get called with:
And this array will then yield
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.
Also, I think this segment of the pre-existing unit test exhibits a similar scenario:
agave/ledger/src/blockstore.rs
Lines 10722 to 10729 in ac663e2