Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Moved deserialization of blobs to entries from replicate_stage to window_service #1287

Merged
merged 1 commit into from
Sep 21, 2018

Conversation

carllin
Copy link
Contributor

@carllin carllin commented Sep 20, 2018

Moving the deserialization of blobs to entries to the window_service so that we don't increment the "consumed" count in the window unless the blob is valid. This prevents cases where the window sends the replicate_stage bogus blobs that it can't deserialize into entries, in which case the blob for that height never get detected/ repaired b/c the window has moved on.

src/window.rs Outdated
// window and exit. *k_data_slot cannot be None at this point,
// so it's safe to unwrap.
let old = mem::replace(k_data_slot, None).unwrap();
recycler.recycle(old, "insert_blob_is_dup");
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you rebase on #1290 after it's merged?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure!

src/window.rs Outdated
// If the blob can't be deserialized, then remove it from the
// window and exit. *k_data_slot cannot be None at this point,
// so it's safe to unwrap.
let old = mem::replace(k_data_slot, None).unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

let old = k_data_slot.take();

@carllin carllin force-pushed the MoveEntryDeserialization branch 2 times, most recently from 19b1df1 to 8b80cd0 Compare September 21, 2018 00:09
w.meta.set_addr(&tn.info.contact_info.ncp);
}
msgs.push(b);
let mut recorder = Recorder::new(Hash::default());
Copy link
Contributor

Choose a reason for hiding this comment

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

This is too much logic to put into a unit test. Can you pull it out into its own function? Not sure if it belongs in this module or useful enough to have a better home? And so much going on there it looks like it could use some tests of its own. Especially the rogue truncate that looks to say, "oops, went too far, but no worries, truncate()."

Copy link
Contributor Author

@carllin carllin Sep 21, 2018

Choose a reason for hiding this comment

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

Yeah, definitely should extract it into a separate function! The truncate was to decouple us from any assumptions about how many entries the Recorder will produce from an empty vector of transactions. Right now an empty vector of transactions should map to exactly one entry so the truncate is unnecessary, but this may not always be the case.

@@ -144,7 +145,7 @@ fn recv_window(
consumed: &mut u64,
received: &mut u64,
r: &BlobReceiver,
s: &BlobSender,
s: &Sender<Vec<Entry>>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Following the "When in Rome" philosophy mentioned in CONTRIBUTING.md, you need to either add an EntrySender type alias somewhere or get rid of the BlobReceiver alias. No mixing of coding styles within a single module please.

@carllin carllin force-pushed the MoveEntryDeserialization branch from 8b80cd0 to 398c9a8 Compare September 21, 2018 18:47
@carllin carllin merged commit c50ac96 into solana-labs:master Sep 21, 2018
carllin added a commit that referenced this pull request Sep 21, 2018
vkomenda pushed a commit to vkomenda/solana that referenced this pull request Aug 29, 2021
…olana-labs#1287)

Bumps [@solana/web3.js](https://github.com/solana-labs/solana-web3.js) from 0.92.1 to 0.92.2.
- [Release notes](https://github.com/solana-labs/solana-web3.js/releases)
- [Commits](solana-labs/solana-web3.js@v0.92.1...v0.92.2)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants