Skip to content

Enabling snapshot generation when loading from ledger tool#10064

Merged
roryharr merged 2 commits intoanza-xyz:masterfrom
roryharr:bugfix_9496_ledger_snapshot_slot
Jan 20, 2026
Merged

Enabling snapshot generation when loading from ledger tool#10064
roryharr merged 2 commits intoanza-xyz:masterfrom
roryharr:bugfix_9496_ledger_snapshot_slot

Conversation

@roryharr
Copy link

@roryharr roryharr commented Jan 15, 2026

Problem

#9496

When creating a snapshot with ledger-tool, snapshot generation is disabled, and the last full snapshot slot isn't set. This allows zero lamport single reference accounts can be removed improperly

Summary of Changes

  • Create a snapshot constructor: new_generate_snapshots_externally
  • Use the the new snapshot constructor if load_and_process_ledger is called with snapshot_slot populated.
  • Assert that latest_full_snapshot_slot is set if building an incremental snapshot in ledger tool

Fixes #9496

@roryharr roryharr force-pushed the bugfix_9496_ledger_snapshot_slot branch from abda4d0 to d852207 Compare January 15, 2026 22:31
@codecov-commenter
Copy link

codecov-commenter commented Jan 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.6%. Comparing base (a79a700) to head (3e8a12e).
⚠️ Report is 24 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #10064       +/-   ##
===========================================
+ Coverage    70.9%    82.6%    +11.6%     
===========================================
  Files         711      844      +133     
  Lines      211507   316672   +105165     
===========================================
+ Hits       150014   261611   +111597     
+ Misses      61493    55061     -6432     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@roryharr roryharr marked this pull request as ready for review January 15, 2026 23:55
@roryharr
Copy link
Author

I'm not sure who should be on the review. Add anyone else if required.

Copy link

@brooksprumo brooksprumo left a comment

Choose a reason for hiding this comment

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

I like this solution.

@brooksprumo
Copy link

I think we should backport to v3.1.

We could do v3.0 as well, but not sure if it is needed. The workaround is to only create full snapshots with ledger-tool, and not incremental snapshots.

Replaced assert!(matches!()) with assert_eq()
@roryharr roryharr requested a review from brooksprumo January 16, 2026 17:03
Copy link

@brooksprumo brooksprumo left a comment

Choose a reason for hiding this comment

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

:shipit:

Nice work!

@brooksprumo brooksprumo added the v3.1 Backport to v3.1 branch label Jan 16, 2026
@mergify
Copy link

mergify bot commented Jan 16, 2026

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.

@roryharr
Copy link
Author

:shipit:

Nice work!

Need a review from steve on this one?

@brooksprumo
Copy link

Need a review from steve on this one?

Yeah, I think that'd be good. Also for the backport-ness.

Copy link

@steviez steviez left a comment

Choose a reason for hiding this comment

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

I see Brooks already approved so LGTM.

One question - was there something in AccountsDb that changed that "broke" making incrementals with ledger-tool ? Or, has this always been broken with ledger-tool ? Thinking about if/how this could have been avoided

I think we should backport to v3.1.

Agreed - the change is focused/minimal and create-snapshot is "critical tooling" by virtue of being a part of the cluster restart workflow.

We could do v3.0 as well, but not sure if it is needed. The workaround is to only create full snapshots with ledger-tool, and not incremental snapshots.

Yeah, I think we hold on v3.0 for now. We'll get some runtime for this change in v3.1 with a planned testnet halt+restart. Assuming no issues, we'll be looking to take v3.1 to MNB very soon after so we hopefully won't need the v3.0 BP

@t-nelson
Copy link

Thinking about if/how this could have been avoided

SnapshotConfig is too convenient. Default impl, SnapshotUsage enum, convenience constructors. Config structs should force review of call sites whenever changed

@roryharr roryharr added this pull request to the merge queue Jan 20, 2026
Merged via the queue into anza-xyz:master with commit 22889ed Jan 20, 2026
48 checks passed
@roryharr roryharr deleted the bugfix_9496_ledger_snapshot_slot branch January 20, 2026 16:57
mergify bot pushed a commit that referenced this pull request Jan 20, 2026
* When creating a snapshot from the ledger tool, ensure that snapshot generation and loading is enabled

* Seperated out common code in ledger_utils

Replaced assert!(matches!()) with assert_eq()

(cherry picked from commit 22889ed)
roryharr added a commit that referenced this pull request Jan 20, 2026
…kport of #10064) (#10123)

Enabling snapshot generation when loading from ledger tool (#10064)

* When creating a snapshot from the ledger tool, ensure that snapshot generation and loading is enabled

* Seperated out common code in ledger_utils

Replaced assert!(matches!()) with assert_eq()

(cherry picked from commit 22889ed)

Co-authored-by: Rory Harris <rory.harris@anza.xyz>
davidrhodus pushed a commit to PipeNetwork/agave that referenced this pull request Feb 4, 2026
…kport of anza-xyz#10064) (anza-xyz#10123)

Enabling snapshot generation when loading from ledger tool (anza-xyz#10064)

* When creating a snapshot from the ledger tool, ensure that snapshot generation and loading is enabled

* Seperated out common code in ledger_utils

Replaced assert!(matches!()) with assert_eq()

(cherry picked from commit 22889ed)

Co-authored-by: Rory Harris <rory.harris@anza.xyz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v3.1 Backport to v3.1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Creating an incremental snapshot from a full snapshot produces an invalid snapshot

5 participants