A3 package 2: the scribe log's mode from config, the filer once per cluster #19

Closed
opened 2026-12-02 10:49:39 +00:00 by vesta · 2 comments
Member

Purpose (feature): the scribe log's reckon-db store takes its mode from configuration instead of the hardcoded single, so a clustered mcl-martha release can run it as a replicated store; and because that same log then holds every node's lessons, the lesson filer runs once per connected partition under mcl_om_singleton instead of once per node.

Raf, 2026-12-02: "Run the whole path (Recommended)" (the crew runs the whole path to one clustered mcl-martha release, in order, without coming back to him). Raf, 2026-12-02: "trust on sight. mcl-martha services should auto-cluster over LAN, no mcl-station required. Distributed Erlang offers us all we need." Raf, 2026-12-02: "Three for failover (Recommended)" (mcl-martha#1 LAN addendum menu).

Refs martha-ai/mcl-martha#1 (A3 package 2, and package 4 for the wrap: "each of mcl-kanban, mcl-mail, mcl-scribe, mcl-whiteboard — reckon-db store mode read from config, not hardcoded single"), macula-services/mcl-om#8 (mcl_om_singleton, packages 3 and 4), reckon-db-org/reckon-db#2 (landed: a cluster join never wipes a store that holds events) and reckon-db-org/reckon-db#14 (open: 5.12.0's leadership-transfer case; the land waits for 5.12.1 on hex).

What this requires of the service

  1. The mode comes from config. mcl_scribe_service:event_store/0 hardcodes mode => single. It reads the service's app env instead, default single, so a standalone release and every existing deployment boot exactly as today. An unknown value fails the boot naming the value, never a silent fallback to single.
    One source of truth: the same function decides both the store's mode and the filer's child shape (below), so they cannot drift.
  2. Never append before the store has joined (reckon-db's cluster guide: "a service on a cluster-mode node does not append until its store has joined", reckon_db_cluster:local_healthy/1). In cluster mode mcl_scribe_store:open/1 waits for the store to join a cluster (a live leader, more than one member, the local Raft server answering) before it returns, so the app does not boot, the mesh does not advertise record_lesson, and no lesson is appended into the join window. The wait is bounded and its failure names the store and that it has not joined. A filer's replay on the data-holder node is safe: that node is the authority and never joins.
  3. The data holder must be started first (operator step). reckon-db's guard refuses every join by a store that holds data, including a join to an already-formed cluster. If the empty nodes of a new cluster meet first they form their own cluster, and the box holding the lessons then refuses it forever (the guide's recovery: stop the empty stores, remove their data_dirs, start them again while the holder is up). The release's deployment notes must say so.
  4. The filer, once per connected partition. With a replicated log every node sees every lesson, so one filer files. The wrap lands here (mcl-graph#15's ruling, and Jupiter's on scribe#16, made it wait for exactly this package): the filer goes behind mcl_om_singleton when the store is clustered, and stays the plain per-node worker when it is single. Under a netsplit global runs one copy per connected partition; the PR states what a double run does on each side, and no new guard is added for it (a new check needs the owner's yes).

Done when

  • mode comes from the service's app env, defaults to single, and an unknown value fails the boot naming it; a test pins both the default and the refusal, and the standalone suite (single mode) stays green unchanged.
  • In cluster mode the app does not proceed until the store has joined; a test opens a cluster-mode store with no peer and sees the boot refuse, naming the store and that it has not joined, after the bounded wait.
  • The filer's child is the mcl_om_singleton guard in cluster mode and the plain worker in single mode, from the one source of truth; a test pins both shapes, and that alone on a node the guard runs the filer and the local name answers.
  • The PR states what a per-partition double filer run does on each side of a netsplit, and why it needs no guard beyond the filer's own at-least-once and final-exactly-once rules.
  • The deployment note names the operator step: start the node whose store holds data before the empty nodes join (README or deploy/), so a fresh cluster cannot form on the empty boxes first.
  • The reckon_db pin floor is ~> 5.12.1 on the tip that is handed off, and the suite is green on it.

Do NOT add a guard or a timer for the split case without the owner's yes (the no-new-check rule); state it instead. Do NOT change single as the default, and do NOT make single the mode for a multi-node deployment in any doc.

Amendment to Done-when 2 (Supervisor, 2026-12-02). The wait is not bounded: it logs what it waits for (scribe_store_not_joined) every few seconds and stays for the operator, because a data holder is refused a join forever and a bounded failure would only put it in a restart loop that hides the cause; a timeout was ruled out. The test sees the boot still holding and the line, not a refusal.

Purpose (feature): the scribe log's reckon-db store takes its `mode` from configuration instead of the hardcoded `single`, so a clustered mcl-martha release can run it as a replicated store; and because that same log then holds every node's lessons, the lesson filer runs once per connected partition under `mcl_om_singleton` instead of once per node. Raf, 2026-12-02: "Run the whole path (Recommended)" (the crew runs the whole path to one clustered mcl-martha release, in order, without coming back to him). Raf, 2026-12-02: "trust on sight. mcl-martha services should auto-cluster over LAN, no mcl-station required. Distributed Erlang offers us all we need." Raf, 2026-12-02: "Three for failover (Recommended)" (mcl-martha#1 LAN addendum menu). Refs martha-ai/mcl-martha#1 (A3 package 2, and package 4 for the wrap: "each of mcl-kanban, mcl-mail, mcl-scribe, mcl-whiteboard — reckon-db store `mode` read from config, not hardcoded `single`"), macula-services/mcl-om#8 (`mcl_om_singleton`, packages 3 and 4), reckon-db-org/reckon-db#2 (landed: a cluster join never wipes a store that holds events) and reckon-db-org/reckon-db#14 (open: 5.12.0's leadership-transfer case; the land waits for 5.12.1 on hex). ## What this requires of the service 1. **The mode comes from config.** `mcl_scribe_service:event_store/0` hardcodes `mode => single`. It reads the service's app env instead, default `single`, so a standalone release and every existing deployment boot exactly as today. An unknown value fails the boot naming the value, never a silent fallback to `single`. One source of truth: the same function decides both the store's mode and the filer's child shape (below), so they cannot drift. 2. **Never append before the store has joined** (reckon-db's cluster guide: "a service on a cluster-mode node does not append until its store has joined", `reckon_db_cluster:local_healthy/1`). In cluster mode `mcl_scribe_store:open/1` waits for the store to join a cluster (a live leader, more than one member, the local Raft server answering) before it returns, so the app does not boot, the mesh does not advertise `record_lesson`, and no lesson is appended into the join window. The wait is bounded and its failure names the store and that it has not joined. A filer's replay on the data-holder node is safe: that node is the authority and never joins. 3. **The data holder must be started first (operator step).** reckon-db's guard refuses every join by a store that holds data, including a join to an already-formed cluster. If the empty nodes of a new cluster meet first they form their own cluster, and the box holding the lessons then refuses it forever (the guide's recovery: stop the empty stores, remove their `data_dir`s, start them again while the holder is up). The release's deployment notes must say so. 4. **The filer, once per connected partition.** With a replicated log every node sees every lesson, so one filer files. The wrap lands here (mcl-graph#15's ruling, and Jupiter's on scribe#16, made it wait for exactly this package): the filer goes behind `mcl_om_singleton` when the store is clustered, and stays the plain per-node worker when it is `single`. Under a netsplit `global` runs one copy per connected partition; the PR states what a double run does on each side, and no new guard is added for it (a new check needs the owner's yes). ## Done when - [x] `mode` comes from the service's app env, defaults to `single`, and an unknown value fails the boot naming it; a test pins both the default and the refusal, and the standalone suite (single mode) stays green unchanged. - [x] In cluster mode the app does not proceed until the store has joined; a test opens a cluster-mode store with no peer and sees the boot refuse, naming the store and that it has not joined, after the bounded wait. - [x] The filer's child is the `mcl_om_singleton` guard in cluster mode and the plain worker in single mode, from the one source of truth; a test pins both shapes, and that alone on a node the guard runs the filer and the local name answers. - [x] The PR states what a per-partition double filer run does on each side of a netsplit, and why it needs no guard beyond the filer's own at-least-once and final-exactly-once rules. - [x] The deployment note names the operator step: start the node whose store holds data before the empty nodes join (README or `deploy/`), so a fresh cluster cannot form on the empty boxes first. - [x] The `reckon_db` pin floor is `~> 5.12.1` on the tip that is handed off, and the suite is green on it. Do NOT add a guard or a timer for the split case without the owner's yes (the no-new-check rule); state it instead. Do NOT change `single` as the default, and do NOT make `single` the mode for a multi-node deployment in any doc. **Amendment to Done-when 2 (Supervisor, 2026-12-02).** The wait is not bounded: it logs what it waits for (`scribe_store_not_joined`) every few seconds and stays for the operator, because a data holder is refused a join forever and a bounded failure would only put it in a restart loop that hides the cause; a timeout was ruled out. The test sees the boot still holding and the line, not a refusal.
Author
Member

Landed on main at a69a2d7c93 (PR 20, fast-forward from d9551a3, Terra on Mars's LAND); PR 20 closed.

Done-when checked against the diff: the mode default, the configured value and the refusal by name are pinned in lesson_log_tests; mcl_scribe_store_tests proves a cluster-mode store holds the boot and logs scribe_store_not_joined with what it waits for; guide_lessons_sup_tests pins the plain child in single mode and the mcl_om_singleton guard in cluster mode, and that alone on a node the guard runs the filer; the per-partition double run is stated in PR 20 with no guard added (Mars/Supervisor's ruling); the operator step sits in the README beside store_mode; and the tip carries {reckon_db, "~> 5.12.1"} (checksum 80F92ACB…31A5) with lint, xref, eunit 88 and dialyzer green on it.

Closing.

Landed on main at a69a2d7c935d02ef7ad2a6409f8a406295c426d5 (PR 20, fast-forward from d9551a3, Terra on Mars's LAND); PR 20 closed. Done-when checked against the diff: the mode default, the configured value and the refusal by name are pinned in `lesson_log_tests`; `mcl_scribe_store_tests` proves a cluster-mode store holds the boot and logs `scribe_store_not_joined` with what it waits for; `guide_lessons_sup_tests` pins the plain child in single mode and the `mcl_om_singleton` guard in cluster mode, and that alone on a node the guard runs the filer; the per-partition double run is stated in PR 20 with no guard added (Mars/Supervisor's ruling); the operator step sits in the README beside `store_mode`; and the tip carries `{reckon_db, "~> 5.12.1"}` (checksum 80F92ACB…31A5) with lint, xref, eunit 88 and dialyzer green on it. Closing.
vesta closed this issue 2026-12-02 12:31:16 +00:00
Author
Member

Main is green on a69a2d7c — the three runs queued when this package was closed all succeeded:

  • 6883 build-push.yml — success, 12:37–12:42Z (the Release job is the v* tag one and stays skipped on a main push)
  • 6884 c4-model.yml — success, 12:38Z
  • 6885 lint.yml — success, 12:39–12:43Z

Nothing is reopened: the store's mode from config and its join gate stand as landed in a69a2d7c.

Main is green on a69a2d7c — the three runs queued when this package was closed all succeeded: - 6883 `build-push.yml` — success, 12:37–12:42Z (the Release job is the `v*` tag one and stays skipped on a main push) - 6884 `c4-model.yml` — success, 12:38Z - 6885 `lint.yml` — success, 12:39–12:43Z Nothing is reopened: the store's mode from config and its join gate stand as landed in a69a2d7c.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
macula-services/mcl-scribe#19
No description provided.