Skip to content

Fix Raft pusher table drift when cluster_peers has duplicates or host:port entries - #70720

Closed
dwoz wants to merge 1 commit into
saltstack:3008.xfrom
dwoz:dwoz/backport/3008.x-pushertable
Closed

dwoz wants to merge 1 commit into
saltstack:3008.xfrom
dwoz:dwoz/backport/3008.x-pushertable

Conversation

@dwoz

@dwoz dwoz commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Backport from master-topology work.

build_peer_pushers used zip(opts["cluster_peers"], pushers_list) to build the Raft dispatcher's pusher table. Two drift conditions silently broke inbound Raft RPCs:

  • Join / discover handlers appended to self.cluster_peers without a dedup check, while self.pushers was deduped by _add_pusher. A zip then truncated to the shorter pushers list, leaving the tail peer unkeyed. Inbound Raft RPCs from that peer logged no pusher for <peer_id>, dropping <tag> reply and pre-vote / append-entries replies were lost.
  • cluster_peers entries can carry an explicit host:port suffix (the peer.rsplit(":", 1) branch in _publish_daemon), while the pusher's pull_host is the bare host. A zip keyed the pusher dict by "host:port" while the dispatcher looked up "host" — never matched.

Fix: key the pusher table by each pusher's own pull_host attribute. Matches the pattern _start_raft_as_learner already uses.

Test plan

  • pytest tests/pytests/unit/cluster/consensus/ tests/pytests/functional/cluster/consensus/ — 511 passed
  • Two new regression tests pin the duplicate and host:port drift conditions

…] zip

topo-east-1 spammed
``RaftDispatcher: no pusher for topo-east-{2,3}, dropping
cluster/raft/pre-request-vote-reply reply`` several times a second
while the symmetric west cluster was quiet.  The asymmetry traced to
a positional ``zip`` in ``build_peer_pushers`` that pairs
``opts["cluster_peers"]`` with the deduplicated ``self.pushers``
list.  Two drift modes silently truncated the pusher table and left
the tail peer unkeyed:

1. ``MasterPubServerChannel.handle_pool_publish`` appends to
   ``self.cluster_peers`` (a reference to ``opts["cluster_peers"]``)
   on every ``cluster/peer/join`` and ``cluster/peer/discover-reply``
   from a peer.  A join from a statically-configured peer grew the
   list with a duplicate while ``_add_pusher``'s
   ``(pull_host, pull_port)`` dedup kept ``self.pushers`` the same
   length.  ``zip`` then stopped one short and the last declared
   peer received no pusher — inbound Raft replies from it hit "no
   pusher" and were dropped.  On the designated founder (east-1 has
   lowest id in its cluster), the 5-second ``cluster_join_timeout``
   deferral leaves a wide window for this race before
   ``_start_raft_as_founding_voter`` runs ``build_peer_pushers``;
   west's founder won the race in the sandbox probe where east lost.

2. A ``cluster_peers`` entry carrying an explicit ``host:port``
   suffix (the ``peer.rsplit(":", 1)`` branch) was keyed as
   ``"host:port"`` in the pusher dict while the dispatcher looks the
   pusher up by the sender's ``callback_node`` = its bare node-id =
   ``"host"``.  Lookup always missed.

Fix mirrors the already-robust ``_start_raft_as_learner`` keying:
build the pusher dict as ``{p.pull_host: p for p in pushers}``.
``opts`` stays in the signature for callers; the opts list is no
longer the source of truth for the dict shape.  Companion changes
in ``MasterPubServerChannel.handle_pool_publish`` gate both
``cluster_peers.append`` sites with a membership check so the
underlying ``opts["cluster_peers"]`` list stops accumulating
duplicates in the first place.

Red-then-green on the two new regression tests in
``tests/pytests/functional/cluster/consensus/test_raft_service.py``
(``test_cluster_peers_duplicate_does_not_lose_pusher`` +
``test_cluster_peers_host_port_form_still_keys_by_host``) via
``git stash`` of the production diff; both fail without the fix and
pass with it.  Full consensus functional suite: 123 passed.
``tests/pytests/unit/channel/test_server.py``: 61 passed.

``FakePusher`` gains a ``pull_host`` attribute so the in-process
test harness mirrors the real ``PublishServer`` surface the
post-fix ``build_peer_pushers`` keys by.
@dwoz
dwoz requested a review from a team as a code owner November 7, 2026 05:31
@dwoz dwoz added the test:full Run the full test suite label Nov 7, 2026
@dwoz dwoz added this to the Argon v3008.7 milestone Nov 7, 2026
@dwoz dwoz mentioned this pull request Nov 9, 2026
3 tasks done
@dwoz

dwoz commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #70755 which combines all five cluster-correctness backports into a single PR.

@dwoz dwoz closed this Nov 9, 2026

This branch was previously deployed

1 inactive deployment
ci — e5f9f6f8 Deployed Nov 7, 2026 by dwoz via Build Onedir Packages / DEB (arm64) #28601
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant