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

Remove unused fields from Bank#22491

Merged
brooksprumo merged 1 commit intosolana-labs:masterfrom
brooksprumo:remove-unused-from-bank
Jan 21, 2022
Merged

Remove unused fields from Bank#22491
brooksprumo merged 1 commit intosolana-labs:masterfrom
brooksprumo:remove-unused-from-bank

Conversation

@brooksprumo
Copy link
Copy Markdown
Contributor

@brooksprumo brooksprumo commented Jan 13, 2022

Problem

Bank (and snapshots) contains unused fields. I'm going to be adding a new snapshot version (and serde style) (see #21604 for info), and have a large PR for that (see PR #22467), but wanted to have as many small, self-contained PRs as possible. Keeping the unused fields in the new snapshot version seems unnecessary.

Summary of Changes

Remove unused fields from Bank.

Questions

  • Should I also bump the snapshot version to 1.2.1? If yes, should I retain snapshot version 1.2.0?
    • A: Nope.

Testing

Manual compatibility testing is required.

created by pr created by v1.8
loaded by pr works [1] works [2]
loaded by 1.8 works [3] works [4]

[1]: Tested via the tests in the code and CI; plus running a validator, creating snapshots, and restarting from them
[2]: Tested by bootstrapping a validator running this PR's code, and downloading a snapshot from the cluster running v1.8
[3]: Running a validator with this PR's code, then creating a snapshot with this new version. Rebuilding the validator with v1.8, and starting up with the new-version's snapshot. Ensure the node connects to mnb. The validator has been running for 2 hours as of me typing this.
[4]: This is the current working impl, so it's presumed good

@brooksprumo brooksprumo marked this pull request as ready for review January 13, 2022 21:17
@brooksprumo brooksprumo requested review from mvines and ryoqun January 13, 2022 21:17
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 13, 2022

Codecov Report

Merging #22491 (6a3cc7e) into master (e291342) will increase coverage by 0.0%.
The diff coverage is 100.0%.

@@           Coverage Diff           @@
##           master   #22491   +/-   ##
=======================================
  Coverage    81.1%    81.1%           
=======================================
  Files         556      556           
  Lines      150655   150638   -17     
=======================================
+ Hits       122268   122294   +26     
+ Misses      28387    28344   -43     

@ryoqun
Copy link
Copy Markdown
Contributor

ryoqun commented Jan 14, 2022

[ ] Should I also bump the snapshot version to 1.2.1? If yes, should I retain snapshot version 1.2.0?

(i posted more general question at #21604; answering this question specifically)

i don't think you need to increment snapshot version as long as there is no compatibility concerns. moreover, if we increment the version, i think older node version causes error if it encountered unknown (newer) version (even like with patch version increment). or is the current snapshot version check code clever enough, striving to the semver?

@brooksprumo
Copy link
Copy Markdown
Contributor Author

moreover, if we increment the version, i think older node version causes error if it encountered unknown (newer) version (even like with patch version increment).

Right! Yes, I'd be planning on backporting so that older node versions would know about newer snapshot versions.

or is the current snapshot version check code clever enough, striving to the semver?

I was assuming semver-like, yes. But maybe that's not necessary/overkill.

@brooksprumo
Copy link
Copy Markdown
Contributor Author

@ryoqun Also, and more generally, is this PR (as is) safe? In other words, is it OK to remove these unused fields from the Bank?

@brooksprumo
Copy link
Copy Markdown
Contributor Author

@ryoqun @mvines Following up to see if this PR needs anything else. TIA!

@carllin
Copy link
Copy Markdown
Contributor

carllin commented Jan 19, 2022

This seems fine, serialization into and out of the snapshot format should remain unchanged

@brooksprumo
Copy link
Copy Markdown
Contributor Author

@ryoqun Thanks in advance for taking another look. I wanted to make sure there weren't any corner cases I had overlooked. (Esp anything related to if the whole Bank struct is hashed and compared across the cluster, but I don't think that happens.)

@brooksprumo brooksprumo changed the title Remove unused fields from Bank, and from snapshots Remove unused fields from Bank Jan 19, 2022
@ryoqun
Copy link
Copy Markdown
Contributor

ryoqun commented Jan 20, 2022

@ryoqun Also, and more generally, is this PR (as is) safe? In other words, is it OK to remove these unused fields from the Bank?

this should be safe. there's little test coverage in snapshot binary compatibility across branches. so, manual tedious testing of loading older/newer snapshot with older/newer node might be needed.

also, as you might already know, bank serialization is factored out of Bank itself for versioning. so, it should be safe as far as i look the rust code changes itself.

@ryoqun
Copy link
Copy Markdown
Contributor

ryoqun commented Jan 20, 2022

(sorry for late replay...)

or is the current snapshot version check code clever enough, striving to the semver?

I was assuming semver-like, yes. But maybe that's not necessary/overkill.

yeah, i think it's overkill. we just copied the version number from the validator node version at the time. let's things keep simple as much as possible.

@brooksprumo
Copy link
Copy Markdown
Contributor Author

@ryoqun

there's little test coverage in snapshot binary compatibility across branches. so, manual tedious testing of loading older/newer snapshot with older/newer node might be needed.

Done. I've performed manual testing and put the results in the PR description. Is that enough testing?

also, as you might already know, bank serialization is factored out of Bank itself for versioning. so, it should be safe as far as i look the rust code changes itself.

👍

Copy link
Copy Markdown
Contributor

@ryoqun ryoqun left a comment

Choose a reason for hiding this comment

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

lgtm!

@brooksprumo brooksprumo merged commit 9977396 into solana-labs:master Jan 21, 2022
@brooksprumo brooksprumo deleted the remove-unused-from-bank branch January 21, 2022 12:04
mergify Bot pushed a commit that referenced this pull request Jan 21, 2022
(cherry picked from commit 9977396)

# Conflicts:
#	runtime/src/serde_snapshot/future.rs
mergify Bot added a commit that referenced this pull request Jan 22, 2022
* Remove unused fields from Bank (#22491)

(cherry picked from commit 9977396)

# Conflicts:
#	runtime/src/serde_snapshot/future.rs

* fixup the backport

Co-authored-by: Brooks Prumo <brooks@solana.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.

3 participants