Recompute hash on load if default hash is stored for the account#519
Recompute hash on load if default hash is stored for the account#519HaoranYi merged 1 commit intoanza-xyz:masterfrom
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #519 +/- ##
=======================================
Coverage 81.8% 81.8%
=======================================
Files 842 842
Lines 228343 228428 +85
=======================================
+ Hits 186954 187040 +86
+ Misses 41389 41388 -1 |
|
we should consider backporting this. before the next release is cut. |
brooksprumo
left a comment
There was a problem hiding this comment.
Are the two functions modified in this PR the only two that are used to load account hashes? Mostly wondering if the Accounts Hash Cache stuff is covered by this PR.
This was posted over in Discord a few days ago: https://discord.com/channels/428295358100013066/439194979856809985/1222663250206789673 Since this change does introduce some potential perf changes (we're now potentially recomputing account hashes), it may need additional justification for backporting. I know that the v1.17 to v1.18 transition won't be impacted, since all real/alive/non-zero lamport accounts will have a non-default account hash, and thus not recompute the hash here, but the v1.18 to v2.0 transition will be impacted. I'm not sure by how much, or how to quantify it though. Regardless of backporting or not, that transition impact will impact some version regardless, so may be OK to backport. |
This will not happen on any 1.18 validators. We could even leave out the accum part that uses the write cache in this change and thus, the backport. the write cache already computes a hash. The only issue here is loading from a snapshot (and thus append vec) where we did not include non-default hashes when the snapshot was created. The only effective change will be at startup no matter what. |
This is already handled here: agave/accounts-db/src/accounts_db.rs Lines 2273 to 2285 in 8153c52 and even here for the testing only index version: agave/accounts-db/src/accounts_db.rs Lines 6665 to 6672 in 8153c52 |
|
Backports to the beta branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. Exceptions include CI/metrics changes, CLI improvements and documentation updates on a case by case basis. |
recompute hash on load if default hash is stored for the account Co-authored-by: HaoranYi <haoran.yi@solana.com> (cherry picked from commit 9ea627c)
"...backports to v1.18 should only be done if necessary to fix a bug or significant performance regression". The issue here is state size and resulting poor performance. Writing default hash (and being tolerant of that) will be delayed by a release cycle if we do not put this in 1.18. 1.18 will fail to load snapshots generated by the next version. |
…nt (backport of anza-xyz#519) (anza-xyz#546) Recompute hash on load if default hash is stored for the account (anza-xyz#519) recompute hash on load if default hash is stored for the account Co-authored-by: HaoranYi <haoran.yi@solana.com> (cherry picked from commit 9ea627c) Co-authored-by: HaoranYi <haoran.yi@gmail.com>
Problem
We are going to store default hash to account's storage in #469.
Before #469 is merged, we need to have all nodes support recompute hash on
load. This PR adds that support.
Summary of Changes
Recompute account's hash on load if the hash stored in account storage is
default hash.
Fixes #