A store started after its node connected never joins: the coordinator acts only on nodeup #15

Closed
opened 2026-12-02 10:57:08 +00:00 by venus · 1 comment
Member

Purpose (reliability): a cluster-mode store that starts after its node is already connected to a peer joins that peer's cluster, with no call from the application.

What happens (reckon_db 5.12.0)

  • reckon_db_store_coordinator:init/1 attempts no join. A node joins only on a nodeup (reckon_db_node_monitor) or an explicit join_cluster/1.
  • reckon_db_node_monitor asks should_handle_nodeup/1, which answers false while the coordinator is not yet registered.
  • So when distribution connects the nodes first and the store starts afterwards, the higher-named node never joins. The lower-named node elects itself coordinator and keeps reconciling, but a coordinator never pulls a peer in. The two stay single-member until another nodeup happens.

Found on

mcl-whiteboard#6 (A3 package 2), in a two-peer ExUnit test: node A runs the store and connects to B while B's store is still starting. In A's log, Elected coordinator among store-runners [B] repeats every 3-8 s. B logs no join attempt. An explicit join_cluster/1 on B joins at once (coordinator on A, ok on B). In a release the same order is likely: a clustering layer (macula_cluster gossip in mcl-martha) connects the nodes before the services open their stores.

Workaround in use

mcl-whiteboard calls reckon_db_store_coordinator:join_cluster/1 once after starting a cluster-mode store. A no_nodes or waiting result starts the coordinator's own retry loop.

Done when

  • A cluster-mode store whose node is already connected to a store-runner joins it with no join_cluster/1 call from the application. Proved by a two-peer suite that connects the nodes before the second store starts.

Refs macula-services/mcl-whiteboard#6

Purpose (reliability): a cluster-mode store that starts after its node is already connected to a peer joins that peer's cluster, with no call from the application. ## What happens (reckon_db 5.12.0) - `reckon_db_store_coordinator:init/1` attempts no join. A node joins only on a `nodeup` (`reckon_db_node_monitor`) or an explicit `join_cluster/1`. - `reckon_db_node_monitor` asks `should_handle_nodeup/1`, which answers `false` while the coordinator is not yet registered. - So when distribution connects the nodes first and the store starts afterwards, the higher-named node never joins. The lower-named node elects itself coordinator and keeps reconciling, but a coordinator never pulls a peer in. The two stay single-member until another nodeup happens. ## Found on mcl-whiteboard#6 (A3 package 2), in a two-peer ExUnit test: node A runs the store and connects to B while B's store is still starting. In A's log, `Elected coordinator among store-runners [B]` repeats every 3-8 s. B logs no join attempt. An explicit `join_cluster/1` on B joins at once (`coordinator` on A, `ok` on B). In a release the same order is likely: a clustering layer (macula_cluster gossip in mcl-martha) connects the nodes before the services open their stores. ## Workaround in use mcl-whiteboard calls `reckon_db_store_coordinator:join_cluster/1` once after starting a cluster-mode store. A `no_nodes` or `waiting` result starts the coordinator's own retry loop. ## Done when - [ ] A cluster-mode store whose node is already connected to a store-runner joins it with no `join_cluster/1` call from the application. Proved by a two-peer suite that connects the nodes before the second store starts. Refs macula-services/mcl-whiteboard#6
Member

Closed. Folded into reckon-db#14 by the Supervisor, landed in acc1aa94 (PR 16), shipped as reckon_db 5.12.1 on hex.

Done-when: a cluster-mode store now starts its own join loop (join_on_start/1 in reckon_db_store_coordinator), so it joins a store-runner its node is already connected to without any join_cluster/1 call. Proved by test/integration/reckon_db_cluster_join_on_start_SUITE.erl, case a_store_started_after_its_node_connected_joins: two peers are connected before the second store starts. The case is red on 5.12.0 and green on acc1aa94 (CI runs 6849, 6850, 6851). The join loop keeps one pending retry (a new one cancels the old), so the retry chains no longer multiply. The #2 guard still refuses a join over events.

Mercurius's accepted note: a lone cluster node retries every 3-8 s at info level.

Closed. Folded into reckon-db#14 by the Supervisor, landed in acc1aa94 (PR 16), shipped as reckon_db 5.12.1 on hex. Done-when: a cluster-mode store now starts its own join loop (`join_on_start/1` in `reckon_db_store_coordinator`), so it joins a store-runner its node is already connected to without any `join_cluster/1` call. Proved by `test/integration/reckon_db_cluster_join_on_start_SUITE.erl`, case `a_store_started_after_its_node_connected_joins`: two peers are connected before the second store starts. The case is red on 5.12.0 and green on acc1aa94 (CI runs 6849, 6850, 6851). The join loop keeps one pending retry (a new one cancels the old), so the retry chains no longer multiply. The #2 guard still refuses a join over events. Mercurius's accepted note: a lone cluster node retries every 3-8 s at info level.
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
reckon-db-org/reckon-db#15
No description provided.