Skip to content

cluster: nodes never dial peers they discover, never retry failed dials, and never drop dead peers #140

Description

@fabracht

The cluster requires a full peer mesh — broadcast() is a single hop over directly-connected peers with no relaying (cluster/quic_transport.rs:342), and a targeted send() to a non-peer fails with NodeNotFound and is discarded. Nothing in the crate routes or relays.

Three gaps make that requirement hard to satisfy:

  1. No discovery dial. A node learns that members exist (partition map, voter gossip, handle_node_alive) but never dials them. connect_to_peer has exactly one caller: a startup loop over --peers (cluster_agent/broker.rs:488). Heartbeats carry no address (node_id, bitmaps, voters only), so a node cannot dial a peer it was not configured with.
  2. No dial retry. A peer that is down at startup logs a warning and is never retried.
  3. Dead peers are never removed. The only mutations to the peers map are two inserts (quic_transport.rs:258, :504); the receiver task simply returns on disconnect. A dead link still counts as connected, so the detection added in warn when the cluster peer mesh is incomplete and fix the seed-node docs #139 misses it, and a restarted node is not re-dialled by the nodes that started before it.

Measured on a live 3-node hub-and-spoke cluster (nodes 2 and 3 each peered only to node 1 — previously the documented setup): cross-node pub/sub between nodes 2 and 3 fails in both directions, and a read on node 3 cannot see data created on node 2. Both are deterministic across repeated runs; mqdb dev test --all reports 4/6 pub/sub and 5/6 DB CRUD on that topology.

Fix direction: propagate node addresses in the gossip, dial discovered members, retry failed dials, and remove peers on disconnect using a per-connection token so that a reconnecting peer's fresh connection is not dropped by the old connection's cleanup.

Every mqdb dev start-cluster topology forms a complete graph, so no existing test covers this. #139 added detection and corrected the documentation; this issue is the root cause.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions