Skip to content

refactor: move snapshot IO options from AccountsDbConfig to SnapshotConfig - #12144

Merged
kskalski merged 3 commits into
anza-xyz:masterfrom
kskalski:ks/snap_unarchive_config
Apr 23, 2026
Merged

kskalski merged 3 commits into
anza-xyz:masterfrom
kskalski:ks/snap_unarchive_config

Conversation

@kskalski

@kskalski kskalski commented Apr 23, 2026 •

Copy link
Copy Markdown

Problem

Functions that load a bank from snapshot archives (bank_from_snapshot_archives, bank_from_latest_snapshot_archives, bank_fields_from_snapshot_archives) accept explicit directory path parameters (bank_snapshots_dir, full_snapshot_archives_dir, incremental_snapshot_archives_dir) that are available on the SnapshotConfig, which can be passed to them directly.
Having snapshot config at hand enables cleaning up IO options controlling direct I/O (O_DIRECT) and io_uring buffer registration for snapshot operations, which are in AccountsDbConfig despite only being relevant to preparing data for accounts-db during snapshot archive unpacking.

Summary of Changes

  • Commit 1 - pass SnapshotConfig instead of explicit path params - removes bank_snapshots_dir, full_snapshot_archives_dir, and incremental_snapshot_archives_dir parameters from bank_from_snapshot_archives, bank_from_latest_snapshot_archives, and bank_fields_from_snapshot_archives; callers now pass &SnapshotConfig and the functions read paths directly from it
  • Commit 2 - move IO options from AccountsDbConfig to SnapshotConfig
    • add use_direct_io: bool and use_registered_io_uring_buffers: bool to SnapshotConfig (defaults: true / true except test-validator)
    • remove the same fields from AccountsDbConfig and its FOR_TESTING/FOR_BENCHMARKS constants
    • change validate_account_paths_for_direct_io to take use_direct_io: bool directly instead of &AccountsDbConfig
    • wire the fields from SnapshotConfig in the validator, ledger-tool, and test-validator; io_setup construction inside bank_from_snapshot_archives / bank_fields_from_snapshot_archives now reads from snapshot_config

(those could be split into 2 PRs, but since second commit provides context/motivation for the first, it should be fine to merge together)

Remove `bank_snapshots_dir` from `bank_from_snapshot_archives` and the
three dir params from `bank_from_latest_snapshot_archives`; read them
from the `snapshot_config` that is now threaded through both functions.
`snapshot_config` is inserted before `genesis_config`.
@kskalski
kskalski force-pushed the ks/snap_unarchive_config branch from 02e4432 to 4f49934 Compare April 23, 2026 10:39
@kskalski
kskalski force-pushed the ks/snap_unarchive_config branch from 4f49934 to 22b8ba3 Compare April 23, 2026 10:57
@codecov-commenter

codecov-commenter commented Apr 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.43137% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.4%. Comparing base (d193754) to head (4c10c25).
⚠️ Report is 8 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##           master   #12144     +/-   ##
=========================================
- Coverage    83.4%    83.4%   -0.1%     
=========================================
  Files         861      861             
  Lines      322807   322802      -5     
=========================================
- Hits       269324   269299     -25     
- Misses      53483    53503     +20     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kskalski
kskalski marked this pull request as ready for review April 23, 2026 11:27

@brooksprumo brooksprumo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks straight forward overall. I agree about keeping the two commits together here. Having them separate was helpful for reviewing too, thanks!

maximum_incremental_snapshot_archives_to_retain:
DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
use_direct_io: false,
use_registered_io_uring_buffers: true,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Noting that when use_registered_io_uring_buffers was in AccountsDbConfig, its default was false, whereas now here it's true.

Also noting that the ACCOUNTS_DB_CONFIG_FOR_TESTING set the value to true though too, so I think behavior is approximately the same as before.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

hm, right... though I guess after Steve's change we no longer use default for accounts db config anymore? maybe we can try to remove the derive

Comment thread snapshots/src/snapshot_config.rs Outdated
maximum_full_snapshot_archives_to_retain: DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
maximum_incremental_snapshot_archives_to_retain:
DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
use_direct_io: false,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In the same vein, snapshots_use_direct_io used to be true in ACCOUNTS_DB_CONFIG_FOR_TESTING. Is there a reason to set the default here to false?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

ok, made both true by default except for test-validator (which maybe could use same values, but it didn't, so let's keep the same sematics for now)

and now I can see that impl Default for SnapshotConfig is probably going to have its TTL set soon ;)

@brooksprumo brooksprumo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

:shipit:

@kskalski
kskalski added this pull request to the merge queue Apr 23, 2026
Merged via the queue into anza-xyz:master with commit f6a98bb Apr 23, 2026
48 checks passed
@kskalski
kskalski deleted the ks/snap_unarchive_config branch April 23, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants