A3 package 2: the store's mode comes from config, and a cluster-mode node appends only after its store has joined (mcl-martha#1) #35
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Purpose (feature): mcl-mail's reckon-db store runs in cluster mode on a box whose config says so, and no command is appended before that node's store has joined the cluster, so a clustered mail never appends into the join window.
Refs martha-ai/mcl-martha#1 (consolidation analysis A3 package 2, §2.3 "Every service"), macula-services/mcl-om#8, reckon-db-org/reckon-db#2, #4 and #14.
Why
A3 package 2 was held back until reckon-db 5.12.0 shipped the join guard (reckon-db#2, R1: a cold-start join used to reset a non-empty joiner's data) and the guide for joining a store that holds data (reckon-db#4). Both are on hex now. The guide's rule for a service is the second half of this package: a service on a cluster-mode node must not append until its store has joined, that is until
reckon_db_cluster:local_healthy(StoreId)is true, because the join counts the store and then joins, and an event appended in that window is wiped by the join.Supervisor's ruling: no service moves to cluster mode before reckon-db 5.12.1 is on hex (reckon-db#14, is_active unanswered during a leadership transfer). So the pin floor is raised to 5.12.1 before this lands, and the shipped default stays
single.What changes
mcl_mail_service:event_store/0takesmodefrom{mcl_mail, store_mode}(single by default, cluster allowed, anything else refused at boot with the value named) instead of the literalsingle.config/sys.config.srcsets it tosingle, which is every box today, and a bundle setsclusterin its own config.evoq_command_router:dispatch/2with identical options. They now callmcl_mail_append:dispatch/1, which in cluster mode answers{error, store_not_joined}whilereckon_db_cluster:local_healthy(mcl_mail_store:id())is false, and in single mode dispatches exactly as today. Reads that append (mark_letter_read, folded into get_mailbox and get_letter) go through the same seam: the delete-after-read rule means a READ appends a fact, and that path is checked like any other.reckon_dbgoes to~> 5.12.0for the build, and to~> 5.12.1before the land (Mars's instruction, Supervisor's floor).Done when
event_store/0's mode comes from config withsingleas the default, and a value that is neither is refused at boot, naming what it got.clusterandlocal_healthyanswering false (meck), every desk's dispatch answers{error, store_not_joined}andevoq_command_router:dispatch/2is never called; with modesinglethe router is called as before. Counted on the mock, not grepped.Landed. PR 36 merged into
mainatf1810103(fast-forward, read back on the origin).Done-when, checked on
mainatf181010:mcl_mail_store:mode/0reads{mcl_mail, store_mode}:singlewhen unset,clusterwhen the config says so, anderror({store_mode_not_a_mode, Bad})for anything else.mcl_mail_service:event_store/0takesmodefrom it, and the shipped config namessingle.the_shipped_config_names_the_default_mode_testholds the config's mode equal to the code's default, so neither side can move alone.every_desk_is_gated_by_the_seam_test_runs each of the nine desks' owndispatch/1with a real command and counts the mocked router: on a cluster store withlocal_healthyfalse each answers{error, store_not_joined}with zero router calls, and on a single store each calls it exactly once. The source scan test sits beside it:mailbox_dispatchis the only module in either app that callsevoq_command_router:dispatch(.MCL_LINT=1 rebar3 lintclean,rebar3 eunit180 tests,rebar3 dialyzerclean over 52 files, and a release rebuilt from an empty_build/prod/relholding evoq 1.32.0, reckon_db 5.12.1 and reckon_evoq 2.10.0 and nothing else by those names.CI on the main push: run 6910 (test, build-and-push, the tested resolve, check, attest; guard/attest skipped by their GitHub-only guards) and run 6911 (c4-model, c4-model-1), all
status=success. On the pull request, runs 6896 (c4-model) and 6897 (lint) green on the same head.Two pin moves beyond the original scope, both from the Supervisor: reckon_db to
~> 5.12.1(5.12.0'sis_activecan go unanswered during a leadership transfer, reckon-db#14) and evoq to~> 1.32(one node in charge of each aggregate, which a shared store needs). No release boot was run: the shipped config is{mesh, required}, so a boot would reach the live realm's stations and file a claim.