A node cannot host two services with different stores: four processes still fall back to one store_id app env #13

Open
opened 2026-12-02 07:14:17 +00:00 by vesta · 0 comments
Member

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_id is 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 to get_or_start/3;
  • src/evoq_aggregates_sup.erl:37 — start_aggregate/2 (marked deprecated), hands it to start_aggregate/3;
  • src/evoq_aggregate.erl:79 — start_link/2 (marked deprecated), hands it to start_link/3;
  • src/evoq_projection.erl:681-683 — a projection started with no store_id in its opts replays from the env's store, else default_store.

src/evoq_execution_context.erl:31 falls 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,408 call get_or_start/3, evoq_aggregate_registry.erl:162 calls start_aggregate/3), so evoq itself is consistent. The harm is at the edges: a service that starts a projection without store_id in 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, or default_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_id set to whichever service wins, which is exactly the per-VM assumption a multi-service node breaks.

Done when

  • A projection started with no store id in its opts refuses by name (it does not replay default_store), and the same for evoq_execution_context when a dispatch names no store.
  • The deprecated get_or_start/2, start_aggregate/2 and start_link/2 either take the store from the caller or refuse by name, naming the explicit arity; nothing selects a store from the app env.
  • A test starts two stores on one node, one projection each, and proves each replays only its own log — with evoq.store_id set to one of them, and unset.
  • The store_id app 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

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_id` is 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 to `get_or_start/3`; - `src/evoq_aggregates_sup.erl:37` — `start_aggregate/2` (marked deprecated), hands it to `start_aggregate/3`; - `src/evoq_aggregate.erl:79` — `start_link/2` (marked deprecated), hands it to `start_link/3`; - `src/evoq_projection.erl:681-683` — a projection started with no `store_id` in its opts replays from the env's store, else `default_store`. `src/evoq_execution_context.erl:31` falls 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,408` call `get_or_start/3`, `evoq_aggregate_registry.erl:162` calls `start_aggregate/3`), so evoq itself is consistent. The harm is at the edges: a service that starts a projection without `store_id` in 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, or `default_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_id` set to whichever service wins, which is exactly the per-VM assumption a multi-service node breaks. ## Done when - [ ] A projection started with no store id in its opts refuses by name (it does not replay `default_store`), and the same for `evoq_execution_context` when a dispatch names no store. - [ ] The deprecated `get_or_start/2`, `start_aggregate/2` and `start_link/2` either take the store from the caller or refuse by name, naming the explicit arity; nothing selects a store from the app env. - [ ] A test starts two stores on one node, one projection each, and proves each replays only its own log — with `evoq.store_id` set to one of them, and unset. - [ ] The `store_id` app 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
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
reckon-db-org/evoq#13
No description provided.