A node cannot host two services with different stores: four processes still fall back to one store_id app env #13
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): a node that hosts several services, each with its own reckon-db store, works — no part of evoq picks a store from one node-wide app env when its caller named one.
Found while doing macula-services/mcl-scribe#16 (wave 2 of martha-ai/mcl-martha#1: several mcl-martha services on one node, each with its own store).
What is wrong
evoq.store_idis one app env per VM, and four places still read it instead of taking the store from the call:src/evoq_aggregate_registry.erl:79—get_or_start/2(marked deprecated) reads it, and hands it toget_or_start/3;src/evoq_aggregates_sup.erl:37—start_aggregate/2(marked deprecated), hands it tostart_aggregate/3;src/evoq_aggregate.erl:79—start_link/2(marked deprecated), hands it tostart_link/3;src/evoq_projection.erl:681-683— a projection started with nostore_idin its opts replays from the env's store, elsedefault_store.src/evoq_execution_context.erl:31falls back the same way when a dispatch names no store.Every internal caller in this release already passes the id (
evoq_command_router.erl:325,408callget_or_start/3,evoq_aggregate_registry.erl:162callsstart_aggregate/3), so evoq itself is consistent. The harm is at the edges: a service that starts a projection withoutstore_idin its opts, or calls a deprecated arity, silently reads the node-wide store — and on a node hosting two services the env can hold only one of them. There the second service's projection replays another service's log, ordefault_store, with no error.The workaround in the caller today is to put the store id in each projection's opts and to leave the node's
evoq.store_idset to whichever service wins, which is exactly the per-VM assumption a multi-service node breaks.Done when
default_store), and the same forevoq_execution_contextwhen a dispatch names no store.get_or_start/2,start_aggregate/2andstart_link/2either take the store from the caller or refuse by name, naming the explicit arity; nothing selects a store from the app env.evoq.store_idset to one of them, and unset.store_idapp env's remaining role is documented (what still reads it, and why), or the key is removed.Refs macula-services/mcl-scribe#16, martha-ai/mcl-martha#1, macula-services/mcl-om#8