skip to content
[readonly]

A member's job log: its records (leadership, snapshot, entry, commit), the replica they replay to, and replay with torn-tail handling

sh
$ sexc add @ajax/mesh-jobs-log
  • total 3
  • drwxr-xr-x-../
  • drwxr-xr-x-Oct 27 05:24v/# 1 version
  • drwxr-xr-x-Oct 27 05:24files/# the files of 0.1.0
latest
0.1.0, published Oct 27 05:24 by ajax
owners
ajax
license
MIT
dependencies
@ajax/mesh-check ^0.1.0, @ajax/mesh-strbuf ^0.1.0, @ajax/mesh-jobs-wire ^0.1.0, @ajax/mesh-jobs-op ^0.1.0, @ajax/mesh-jobs-table ^0.1.0
dependents
@ajax/mesh-jobd-store, @ajax/mesh-jobs-merge, @ajax/mesh-jobs-node, @ajax/mesh-jobs-out
keywords
mesh alphaos jobs log replication
homepage
https://github.com/thomasdavis/alpha-c-mesh/tree/main/packages/mesh-jobs-log
repository
https://github.com/thomasdavis/alpha-c-mesh
==> README.md <==
1# @ajax/mesh-jobs-log
2
3What a member persists of the job table, and what that replays to. The log is append-only and has
4four kinds of record:
5
6- **LID** is the highest leadership the member followed or led. A restarted member never follows an
7  older one, and leads above it.
8- **SNAPSHOT** is the committed table at a commit point. It keeps the entries past that point
9  (review finding 6).
10- **ENTRY** is an entry not committed yet: a delta, or a replace (a new leader's merge, which drops
11  older leaderships' entries).
12- **COMMIT** marks that a leadership's entries up to n are committed.
13
14`mj_replay` rebuilds the replica exactly. Entries never committed stay pending and never reach the
15committed table (review finding 5). A torn last record ends the replay (review finding 4), while a
16whole record that doesn't decode is an error. `mj_replica_log` writes the compacted log that replays
17to the same replica.
18
19## Ported from
20
21[alpha-rust-mesh](https://github.com/rsafier/alpha-rust-mesh) (Richard Safier, MIT):
22`crates/mesh-host/src/jobs.rs`: `Log` (`encode`, `decode`), `Entry`, `Replica` (`apply`, `last`,
23`log`), `replay`.
24
25## Tests
26
27`tests/log.c`:
28- Four random sequences of 400 records, built from the same generator as the Rust golden test, replay
29  to the same replica as in the Rust: its compacted log's hash, leadership, commit point, pending
30  entries and `last`. Each compaction replays back to it.
31- The log of the Rust's `ops_frames_and_the_merge`, byte for byte, with its torn tail dropped.
32- Review finding 6's snapshot (`a_snapshot_keeps_the_entries_acknowledged_past_it`).
33- Replay's answers to corrupt records, word for word the Rust's.
34
35## Licence
36
37MIT. See the repository's LICENSE.