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

disk: replay, epoch compatibility, and lmdb modules #241

Open
wants to merge 4 commits into
base: status
Choose a base branch
from

Conversation

matthew-levan
Copy link
Contributor

@matthew-levan matthew-levan commented Jun 13, 2024

This PR adds bare bones replay functionality for vere-v3.0-style piers, meaning that one may:

  • Boot ships with the vere-v3.0 king and Ares serf
  • Restart ships which have been booted as above
  • Perform a full replay of such a ship by deleting its .urb/chk/data.pma file

To achieve these results, very basic modules have been added for lmdb, disk, and mars. These are not well thought-out or designed-- instead, they are "minimum viable" and, as such, include numerous todo comments sprinkled throughout.

I have tested this PR on:

  • macos-aarch64
  • linux-x86_64
    • For some reason, booting a fresh fake ship on this platform just hangs after binary copy succeeded

To fix functionality for linux-x86_64, we use MDB_NOLOCK (see disk.rs:44):

Do not do any locking. If concurrent access is anticipated, the caller must manage all concurrency themself. For proper operation the caller must enforce single-writer semantics, and must ensure that no readers are using old transactions while a writer is active. The simplest approach is to use an exclusive lock so that no readers may be active at all when a writer begins.

Thus, we have two invariants to maintain:

  • Only one writer is active at any given time.
    • We satisfy this because we never write from Rust (in fact, we don't even have any write functions implemented).
  • No reader uses old transactions while a writer is active.
    • We satisfy this because we only read from the database during replay or when initializing the serf (our patterns mirror Vere's) and our read transactions are never active while a write transaction is also active.

Future work:

  • Use mugs to verify replay correctness
  • Achieve parity with Vere replay, including play arguments
  • Use a real CLI parsing crate (or something along the lines that's better than our manual argv parsing)
  • Handle IPC responses correctly, instead of printing garble
  • Ensure safety against snapshot and/or event log corruption during replay
  • Clean up code (Rust idioms, etc.)
  • Look into why serf: bail is printed during boot and replay
  • Think through and document proper designs for these systems when working on Ares "full Mars" implementation
  • Implement replay tests for CI

@matthew-levan matthew-levan added this to the Vere compatibility milestone Jun 14, 2024
@matthew-levan matthew-levan marked this pull request as ready for review June 24, 2024 13:29
@matthew-levan
Copy link
Contributor Author

@eamsden Not sure why linting fails on the serf::next function as it exists in status as well.

@matthew-levan matthew-levan changed the title disk: basic replay, epoch compatibility, and lmdb modules disk: replay, epoch compatibility, and lmdb modules Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

None yet

1 participant