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

feat(accountsdb,gossip): Initial snapshot propagation work #333

Merged
merged 25 commits into from
Nov 6, 2024

Conversation

InKryption
Copy link
Contributor

@InKryption InKryption commented Oct 24, 2024

This change set is centered around advertising snapshot generation to gossip, which in and of itself is not huge. It comes with a myriad of satellite refactors, improvements, and bug fixes which I encountered while I was in the process of testing/integrating the change in a smooth way, as well as experiments in setting up the RPC server for serving the advertised snapshots, which will instead be done in a follow-up PR.

@InKryption InKryption self-assigned this Oct 24, 2024
@dnut dnut linked an issue Oct 25, 2024 that may be closed by this pull request
4 tasks
@InKryption InKryption force-pushed the ink/send-snapshots branch 8 times, most recently from fff94e2 to 1480030 Compare October 31, 2024 06:47
@InKryption
Copy link
Contributor Author

Interesting failure on the CI: https://github.com/Syndica/sig/actions/runs/11614796242/job/32343808753?pr=333
Seems like an error is triggering the defer gossip_service.deinit(), without reaching the gossip_service.shutdown().

@InKryption InKryption changed the title feat(accountsdb,gossip): Snapshot propagation feat(accountsdb,gossip): Initial snapshot propagation work Oct 31, 2024
src/accountsdb/db.zig Outdated Show resolved Hide resolved
@InKryption
Copy link
Contributor Author

InKryption commented Oct 31, 2024

I still want to try resolve that TODO, but the code should now be in a state that's suitable for review.

@InKryption InKryption marked this pull request as ready for review October 31, 2024 15:47
@InKryption
Copy link
Contributor Author

Alright there ended up being a simple workaround for the time being.

Copy link
Contributor

@0xNineteen 0xNineteen left a comment

Choose a reason for hiding this comment

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

mostly small naming things - looks good otherwise

src/accountsdb/db.zig Outdated Show resolved Hide resolved
src/accountsdb/db.zig Outdated Show resolved Hide resolved
src/accountsdb/db.zig Show resolved Hide resolved
src/accountsdb/db.zig Show resolved Hide resolved
src/accountsdb/db.zig Outdated Show resolved Hide resolved
src/accountsdb/db.zig Outdated Show resolved Hide resolved
src/accountsdb/db.zig Show resolved Hide resolved
src/gossip/data.zig Outdated Show resolved Hide resolved
src/gossip/data.zig Outdated Show resolved Hide resolved
src/gossip/service.zig Outdated Show resolved Hide resolved
@InKryption InKryption force-pushed the ink/send-snapshots branch 2 times, most recently from 7bbd6ed to b27f6ac Compare November 5, 2024 19:51
Copy link
Contributor

@Sobeston Sobeston left a comment

Choose a reason for hiding this comment

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

Haven't touched gossip yet so can't be 100% on that, but all seems good.
I like the additional comments and InitParams on accountsdb.

One thing that I haven't marked:

  • should we be prefixing optional fields with maybe_ like we do for vars and consts? e.g.
    • geyser_writer
    • gossip_push_msg_queue

src/utils/tar.zig Show resolved Hide resolved
src/accountsdb/db.zig Outdated Show resolved Hide resolved
Copy link
Contributor

@0xNineteen 0xNineteen left a comment

Choose a reason for hiding this comment

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

:shipit:

Copy link
Contributor

@Sobeston Sobeston left a comment

Choose a reason for hiding this comment

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

👍

1. Guard the full and incremental snapshot info under the same rwmux,
  both to deduplicate the full slot value, and to synchronize the
  existence of incremental snapshots relative to full snapshots.
2. Also do the same with the first snapshot info.
* Grouped fields into a few categories.
* Change init to take only an `InitParams` struct.
* Lowercase `AllocatorConfig` fields.
* Share the `AllocatorConfig` enum tag across a few different places.
* Inline `InitConfig`'s fields and remove it.
* Fix code that potentially leaked a disk allocator pointer.
It was incorrectly reporting `file_info.length` as the file size,
when it should have been using `account_file.memory.len`.
This also adds a couple more runtime checks to assert the total written
bytes are aligned to full 512 byte blocks.
It's currently disabled because it overwrites the snapshot archives
in the test data dir; can comment the skip statement in order to
test it locally for now. As the TODO says, we need a mechanism for
loading from a snapshot which isn't in the accountsdb's snapshot
working directory.
This also adds a simple way to test the equality of the `SnapshotHashes`
structure in tests.
The potential memory savings were minimal at best, and came at a
significant cost in complexity - a simple tagged union is sufficient
to avoid the overhead of an allocation, whilst retaining simplicity
across the rest of the code (especially wrt generic comparisons).
Sequence it before deinit
In the future there should be a better API for loading from a snapshot
that's outside the accountsdb snapshot working directory.
* Refactor `initSigned`, and related init methods, and call sites.
* Move methods into more scoped types.
* Flatten the `Gossip` struct into `AccountsDB`, and only
  store `my_pubkey`, instead of the whole key pair.
* Change `push_msg_queue` to queue unsigned gossip data, and then
  sign it in `drainPushQueueToGossipTable`.
* Set the wallclock time in `drainPushQueueToGossipTable` as well.
@InKryption InKryption merged commit c9b77a1 into main Nov 6, 2024
6 checks passed
@InKryption InKryption deleted the ink/send-snapshots branch November 6, 2024 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Snapshot Propagation
3 participants