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

Rename SnapshotHashes to LegacySnapshotHashes #31086

Merged
merged 1 commit into from
Apr 10, 2023

Conversation

brooksprumo
Copy link
Contributor

@brooksprumo brooksprumo commented Apr 6, 2023

Problem

To handle bootstrap better, we'll be changing how IncrementalSnapshotHashes will be used. It will contain hashes for both full and incremental snapshots. Then, the current SnapshotHashes will no longer be used, and should be indicated as such.

Summary of Changes

Rename SnapshotHashes to LegacySnapshotHashes.

Also rename the push/pull functions to include "legacy" in the name.

(The next PR will rename IncrementalSnapshotHashes to SnapshotHashes)

@brooksprumo brooksprumo self-assigned this Apr 6, 2023
@brooksprumo brooksprumo requested a review from behzadnouri April 6, 2023 20:01
@codecov
Copy link

codecov bot commented Apr 6, 2023

Codecov Report

Merging #31086 (eafdc69) into master (f9276d1) will increase coverage by 0.0%.
The diff coverage is 75.5%.

@@           Coverage Diff           @@
##           master   #31086   +/-   ##
=======================================
  Coverage    81.5%    81.5%           
=======================================
  Files         728      728           
  Lines      205783   205790    +7     
=======================================
+ Hits       167835   167889   +54     
+ Misses      37948    37901   -47     

@brooksprumo brooksprumo marked this pull request as ready for review April 7, 2023 15:15
@@ -479,7 +479,7 @@ impl AccountsHashVerifier {
hashes.push((accounts_package.slot, *accounts_hash.as_hash()));
}

retain_max_n_elements(hashes, MAX_SNAPSHOT_HASHES);
retain_max_n_elements(hashes, MAX_LEGACY_SNAPSHOT_HASHES);
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this actually be MAX_ACCOUNT_HASHES?

This whole file does not seem to be about snapshot-hashes, but only account-hashes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you're correct, good catch. I had used my editor's LSP to rename MAX_SNAPSHOT_HASHES but did not audit the changes in this file. I'll change 'em to use MAX_ACCOUNTS_HASHES.

Comment on lines 219 to 220
pub base: (Slot, Hash),
pub hashes: Vec<(Slot, Hash)>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this already includes base which I am guessing is the full snapshot hash;
So why do we need a new SnapshotHashes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question! We could use IncrementalSnapshotHashes instead; I was under the impression that we would want to remove the Vec for most space savings. Would it be better to repurpose IncrementalSnapshotHashes instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Repurposing IncrementalSnapshotHashes and setting MAX_INCREMENTAL_SNAPSHOT_HASHES = 1 should get us most of the way there, w.r.t. space savings.

Is this a better trade off, to avoid adding more data variants to gossip? There will still be some rollout management to coordinate, but we won't have to worry about turning on/off any new/legacy data types.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why we can't just use current IncrementalSnapshotHashes without any changes?
I mean #30759 claims that:

Bootstrap runs into issues when it is discovering snapshots due to full snapshots and incremental snapshots gossiping out separately.

But from IncrementalSnapshotHashes struct, it does look like it is gossip both full and incremental snapshots together!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we can use IncrementalSnapshotHashes without any changes.

I would like to make a few naming changes though:

  1. rename SnapshotHashes and IncrementalSnapshotHashes to LegacySnapshotHashes and SnapshotHashes, respectively
  2. rename base and hashes to full and incremental, respectively

Maybe (1) is not needed? It seems usefully to at least rename SnapshotHashes to LegacySnapshotHashes even if we do not rename IncrementalSnapshotHashes.

I think it'd also be useful to reduce the value for MAX_INCREMENTAL_SNAPSHOT_HASHES, but that can be handled later.

Copy link
Contributor

@behzadnouri behzadnouri Apr 10, 2023

Choose a reason for hiding this comment

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

I would like to make a few naming changes though:

  1. rename SnapshotHashes and IncrementalSnapshotHashes to LegacySnapshotHashes and SnapshotHashes, respectively

  2. rename base and hashes to full and incremental, respectively

yeah, this sounds fine.

I think it'd also be useful to reduce the value for MAX_INCREMENTAL_SNAPSHOT_HASHES, but that can be handled later.

Any reason to do this other than saving bytes from bandwidth?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any reason to do this other than saving bytes from bandwidth?

Saving bandwidth was the primary reason. If that's not worth it though, I won't pursue.

@brooksprumo brooksprumo force-pushed the snapshot-gossip/legacy branch from 4134bb9 to eafdc69 Compare April 10, 2023 20:02
@brooksprumo
Copy link
Contributor Author

@behzadnouri This PR has been updated to just handle the rename from SnapshotHashes to LegacySnapshotHashes. The next PR (#31136) will handle renaming IncrementalSnapshotHashes to SnapshotHashes.

Let me know if you would like me to combine the two PRs though.

@brooksprumo brooksprumo merged commit f3083ad into solana-labs:master Apr 10, 2023
@brooksprumo brooksprumo deleted the snapshot-gossip/legacy branch April 10, 2023 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

2 participants