The station read model moves off RocksDB to an ETS table (design step 1a) #1

Closed
opened 2026-11-23 00:02:09 +00:00 by hygiea · 1 comment
Member

Purpose (work): mcl-stations stops using RocksDB — its directory is served from one ETS table owned by a store process, and the service writes nothing to disk — so the RocksDB images can be deleted once every service is ported.

DECIDED 2026-11-23 (Raf): "we don't use rocksDB anymore", then "Port them off, then delete (Recommended)". This is step 1a of macula-io/macula-ci-images#19, the design's §2 "mcl-stations → ETS", frozen and passed (sha256 425c13eb…).

What lands:

  • one ETS set, keyed by the signer's key id, owned by a new station_store process; it does every read-modify-write, because a station's node_record and station_endpoint arrive independently and land in one row, so two writers would erase each other's fields;
  • a sweep that drops a row once NEITHER of its records is live, on the same is_live/2 the readers use — before, a lapsed row was skipped at serve time and kept forever;
  • barrel_docdb, the rocksdb overrides block in rebar.config and rocksdb_link_tests are removed; the images become the plain pair, macula-ci-otp (build) and macula-pq-runtime (run), pinned by digest on the forge's own registry;
  • no migration: the model is a cache of what the DHT holds, refilled from the snapshot at every boot, so MCL_DATA_DIR and data_dir/0 go.

Still on the owner AFTER this lands, and deliberately not in this change: drop /bulk0/mcl-stations:/data from beam03's compose and delete /bulk0/mcl-stations once the new version is healthy — 50 GB, nothing to keep. That is Raf's pin signature and goes through the Supervisor's menu.

Refs macula-io/macula-ci-images#19

Purpose (work): mcl-stations stops using RocksDB — its directory is served from one ETS table owned by a store process, and the service writes nothing to disk — so the RocksDB images can be deleted once every service is ported. DECIDED 2026-11-23 (Raf): "we don't use rocksDB anymore", then "Port them off, then delete (Recommended)". This is step 1a of macula-io/macula-ci-images#19, the design's §2 "mcl-stations → ETS", frozen and passed (sha256 425c13eb…). What lands: - one ETS `set`, keyed by the signer's key id, owned by a new `station_store` process; it does every read-modify-write, because a station's `node_record` and `station_endpoint` arrive independently and land in one row, so two writers would erase each other's fields; - a sweep that drops a row once NEITHER of its records is live, on the same `is_live/2` the readers use — before, a lapsed row was skipped at serve time and kept forever; - `barrel_docdb`, the rocksdb `overrides` block in `rebar.config` and `rocksdb_link_tests` are removed; the images become the plain pair, `macula-ci-otp` (build) and `macula-pq-runtime` (run), pinned by digest on the forge's own registry; - no migration: the model is a cache of what the DHT holds, refilled from the snapshot at every boot, so `MCL_DATA_DIR` and `data_dir/0` go. Still on the owner AFTER this lands, and deliberately not in this change: drop `/bulk0/mcl-stations:/data` from beam03's compose and delete `/bulk0/mcl-stations` once the new version is healthy — 50 GB, nothing to keep. That is Raf's pin signature and goes through the Supervisor's menu. Refs macula-io/macula-ci-images#19
Member

Purpose (work) met: mcl-stations no longer uses RocksDB — the directory is served from one ETS table owned by a store process, and the service writes nothing to disk.

It was already met on main before this package was picked up, by e4f3186 (2026-11-23 00:00Z) "store: the station read model moves from barrel_docdb to an ETS table". Its forge PR 2 was closed without a merge commit, which is why it read as unbuilt.

Checked bullet by bullet against main 8ded83a:

  • one ETS set, protected, named_table, keyed by the signer's key id, owned by the new station_store; every write is a read-modify-write inside that process (store/2 -> lookup/1 -> project_node_record/2 / project_station_endpoint/2), which is what keeps the two independently-arriving record types from erasing each other in one row;
  • the sweep drops a row once station_read_model:is_live/2 says neither record is live (station_store:dead/4), the same function the readers use; sweep_now/0 lets a suite drive it without sleeping;
  • barrel_docdb, the rocksdb overrides block in rebar.config and rocksdb_link_tests.erl are gone — no non-comment hit for barrel_docdb or rocksdb remains under apps/;
  • the images are the plain pair, macula-ci-otp (build) and macula-pq-runtime (run), pinned by digest on git.macula.io, and mcl_stations_service_tests guards both pins;
  • no migration: no MCL_DATA_DIR and no data_dir/0 under apps/; the supervisor starts the store before the feeder (rest_for_one); CHANGELOG.md's 0.7.0 entry records the change.

Verified on msi00 in the pinned macula-ci-otp digest the same test.yml uses (sha256:3e202cf7…), on main: rebar3 lint rc=0, rebar3 xref rc=0, rebar3 eunit all 132 tests passed, rebar3 dialyzer rc=0.

Both guards are tested, proven by mutation on main's code (source restored byte-identically after each):

  • the store's read-modify-write: with lookup/1 answering undefined (the read half dropped), 4 tests fail by name, including upsert_station_endpoint_leaves_node_record_fields_alone/1 and upsert_node_record_leaves_endpoint_fields_alone/1.
  • the sweep's is_live guard: inverted, a_sweep_drops_a_row_once_neither_record_is_live/1 and a_sweep_keeps_a_row_while_one_record_is_live/1 fail by name.

Note on the first form of the RMW mutant: dropping the whole lookup call from store/2 is not a kill in this repository — it leaves lookup/1 unused and warnings_as_errors makes that a compile error. It was re-expressed inside lookup/1 instead. Same class as mcl-mail#12's M1 today.

Still on the owner, as this issue says: drop /bulk0/mcl-stations:/data from beam03's compose and delete /bulk0/mcl-stations once the new version is healthy — Raf's pin signature, through the Supervisor's menu.

Purpose (work) met: mcl-stations no longer uses RocksDB — the directory is served from one ETS table owned by a store process, and the service writes nothing to disk. It was already met on main before this package was picked up, by `e4f3186` (2026-11-23 00:00Z) "store: the station read model moves from barrel_docdb to an ETS table". Its forge PR 2 was closed **without a merge commit**, which is why it read as unbuilt. Checked bullet by bullet against main `8ded83a`: - one ETS `set`, `protected`, `named_table`, keyed by the signer's key id, owned by the new `station_store`; every write is a read-modify-write inside that process (`store/2` -> `lookup/1` -> `project_node_record/2` / `project_station_endpoint/2`), which is what keeps the two independently-arriving record types from erasing each other in one row; - the sweep drops a row once `station_read_model:is_live/2` says neither record is live (`station_store:dead/4`), the same function the readers use; `sweep_now/0` lets a suite drive it without sleeping; - `barrel_docdb`, the rocksdb `overrides` block in `rebar.config` and `rocksdb_link_tests.erl` are gone — no non-comment hit for `barrel_docdb` or `rocksdb` remains under `apps/`; - the images are the plain pair, `macula-ci-otp` (build) and `macula-pq-runtime` (run), pinned by digest on `git.macula.io`, and `mcl_stations_service_tests` guards both pins; - no migration: no `MCL_DATA_DIR` and no `data_dir/0` under `apps/`; the supervisor starts the store before the feeder (`rest_for_one`); `CHANGELOG.md`'s 0.7.0 entry records the change. Verified on msi00 in the pinned `macula-ci-otp` digest the same `test.yml` uses (`sha256:3e202cf7…`), on main: `rebar3 lint` rc=0, `rebar3 xref` rc=0, `rebar3 eunit` **all 132 tests passed**, `rebar3 dialyzer` rc=0. Both guards are tested, proven by mutation on main's code (source restored byte-identically after each): - **the store's read-modify-write**: with `lookup/1` answering `undefined` (the read half dropped), 4 tests fail by name, including `upsert_station_endpoint_leaves_node_record_fields_alone/1` and `upsert_node_record_leaves_endpoint_fields_alone/1`. - **the sweep's `is_live` guard**: inverted, `a_sweep_drops_a_row_once_neither_record_is_live/1` and `a_sweep_keeps_a_row_while_one_record_is_live/1` fail by name. Note on the first form of the RMW mutant: dropping the whole `lookup` call from `store/2` is **not** a kill in this repository — it leaves `lookup/1` unused and `warnings_as_errors` makes that a compile error. It was re-expressed inside `lookup/1` instead. Same class as mcl-mail#12's M1 today. Still on the owner, as this issue says: drop `/bulk0/mcl-stations:/data` from beam03's compose and delete `/bulk0/mcl-stations` once the new version is healthy — Raf's pin signature, through the Supervisor's menu.
juno closed this issue 2026-11-24 00:52:58 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
2 participants
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-stations#1
No description provided.