A3 package 2: the store mode comes from config, nothing appends before the join, and the crew reconcile runs once per cluster #15
Loading…
Reference in a new issue
No description provided.
Delete branch "juno/14-a3-cluster-store"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The board runs on a clustered event store (mcl-kanban#14, A3 package 2): the store's mode comes from config, nothing is appended before the store has joined, and in cluster mode the 60 s crew reconcile runs on one node of the cluster.
Refs #14
Refs reckon-db-org/reckon-db#2
Refs reckon-db-org/reckon-db#14
What changes
GuideCardLifecycle.Store.mode/0reads:guide_card_lifecycle, :store_mode(default:single, refused by name when it is neither:singlenor:cluster), andMclKanban.Service.event_store/0opens the store in it.MCL_STORE_MODEnames it for the standalone release; a release that hosts several services sets it per service. The README has the variable and a "Cluster mode" section.GuideCardLifecycle.Store.dispatch/1is the board's one dispatch funnel (C2), so the gate lives there: in:singlemode it dispatches as today and never asks the cluster module; in:clustermode it answers{:error, :store_not_joined}— the caller's named error, not a crash — untilreckon_db_cluster.local_healthy/1istrue(a live leader, more than one member, and a local Raft server that answers). reckon-db's join guard counts the store and then resets the joiner's tree, so an append to an empty joining node inside that window would be acknowledged and then wiped (reckon-db/guides/cluster_consistency.md, "Do not append before the store has joined"). Subscribing before the join is fine: live subscriptions are carried across it.MclKanban.Supervisor.children/0picks the child byGuideCardLifecycle.Store.mode/0: in:clusterit listsCrewStandingReconcilerthroughmcl_om_singleton.child_spec/2; in:single, the default, it lists the plain child. That is #11's own rule: in single mode each node holds its own store, so a singleton would reconcile one node's roster and leave every other node's unreconciled — a crew on another node's board would never be discharged. A node without distribution (the standalone release) runs the cluster shape exactly as before.The operator rule (a)
A store that holds data refuses every join, including a join to a cluster that already exists, because a join resets the joiner's tree (reckon-db#2). So start the node whose store holds the data first; it is elected coordinator and the empty nodes join it. Empty nodes that cluster first serve an empty store; two nodes that each hold events stay apart rather than merge. This is stated where the mode is read, in the README, and in #14.
A netsplit (c)
mcl_om_singletonruns one copy per connected partition — that is howglobalbehaves in a split. Each copy keeps its owncounts, so a side counts only the realm answers it received, and a crew is discharged only after the realm told that sideunknown_crewunknown_limittimes in a row. Both sides discharge on the same evidence, never on twice the evidence; the two discharges are the same evoq command, and reckon-db's version check settles the duplicate append (whether evoq retries the loser is unconfirmed, analysis A1). Neither copy can end a crew the realm still answers for. No new check is added for this.Build and land
Built against reckon_db 5.12.1, the pin floor now in both apps: 5.12 carries the join guard this rests on, and 5.12.1's leader answers
is_activewhile it activates (reckon-db#14), which the land waited for. The floor was raised in a diff-only round on its own green run. The same round sets the evoq floor to~> 1.32in all three apps (guide_card_lifecycle, mcl_kanban, project_boards), which carries the one-node-per-aggregate routing a clustered store needs.Proof
Same tree, locally:
mix format --check-formattedclean,mix compile --warnings-as-errorsclean, credo no issues, dialyzer passed, full suite 242/28/22/70/37 tests with 0 failures — re-run unchanged on 5.12.1. A standalone release was built and booted on 5.12.1: it migrated,/healthansweredokwith"org":"mcl-kanban", and its data stayed at the root in:singlemode; it booted again withMCL_STORE_MODE=clusteron a lone node, so both shapes start. Mutants, each caught: the gate never refusing;:singleasking the cluster module; no mode validation; the tree fixed to:cluster(the single-mode case fails); the tree never wrapping the reconciler (the cluster-shape case fails).A3 package 2. GuideCardLifecycle.Store reads the mode from :guide_card_lifecycle, :store_mode (default :single, refused by name when it is neither :single nor :cluster), and MclKanban.Service.event_store/0 opens the store in it; MCL_STORE_MODE names it for the standalone release. The board appends nothing until a cluster-mode store has joined: Store.dispatch/1 is the one dispatch funnel since C2, and in :cluster mode it answers {:error, :store_not_joined} until reckon_db_cluster:local_healthy/1 does -- reckon-db's join guard counts the store and then resets the joiner's tree, so an append to an empty joining node inside that window would be acknowledged and wiped. :single mode is always yes and never asks the cluster module. The crew reconcile is wrapped in mcl_om_singleton again, which mcl-kanban#11 left out while every node had its own store: with one store per node a singleton would have reconciled one node's roster only. It runs one copy per connected partition, which the README and the issue state. reckon_db moves to ~> 5.12 for the join guard; the floor is raised to ~> 5.12.1 before the HANDOFF (reckon-db#14), so this does not land on 5.12.0. Refs macula-services/mcl-kanban#14 Refs reckon-db-org/reckon-db#2