Repository navigation
Peer calls and Raft proposals go through ports - #135
Conversation
PR SummaryHigh Risk Overview Adds
Reviewed by Cursor Bugbot for commit f5260d0. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit f5260d0. Configure here.
| }; | ||
| raft.client_write(ClusterRequest::ShardMapMutation(Box::new(tp))) | ||
| consensus | ||
| .propose(ClusterRequest::ShardMapMutation(Box::new(tp))) |
There was a problem hiding this comment.
Drain ignores refused primary transfer
High Severity
Drain now calls propose for TransferPrimary, which returns a leader refusal as Ok with ok: false. Only transport errors are checked, so a stale-epoch (or other) refusal is treated as success and drain continues. On a follower this is new: the old local client_write failed instead of returning a response, so a refused handoff can finish drain while this node is still primary.
Reviewed by Cursor Bugbot for commit f5260d0. Configure here.
b144dbf to
5d6cd4d
Compare
709ee76 to
8691b11
Compare
5d6cd4d to
09fa4e9
Compare
8691b11 to
f27b835
Compare
…seam domain::cluster::peer_rpc::PeerRpcError keeps the peer's HTTP status apart from an unreachable peer (callers act on 404/405/409/429/503). ports::peer_rpc::PeerRpc is the port; adapters::cluster::http_peer_rpc implements it on PeerClient's pooled clients. The HttpTransport seam in adapters/cluster/transport.rs, never wired up, is deleted. MvHandoffRequest moves to domain::sharding::types.
ShardRoutingContext carries the PeerRpc port and the cluster membership next to PeerClient, which the following commits stop using.
PeerRpc gains shard_bootstrap, shard_write, shard_write_batch, shard_query (the Arrow reply as a byte stream, still decoded chunk by chunk), shard_metadata and shard_delete. The routing, query, metadata scatter and forward-coalescer call sites use them and keep their status handling (409 stale epoch, 429/503 capacity, 400/422 refused, 404/405 older peer) by matching PeerRpcError. error_chain moves to crate::error so the adapter can use it.




Stacked on #133. Plan:
docs/superpowers/plans/2026-11-03-peer-rpc-port.md.The application layer stops talking HTTP and Raft directly:
PeerRpcport (ports/peer_rpc.rs) with a reqwest adapter (adapters/cluster/http_peer_rpc.rs). Every peer call goes through it: shard write, write-batch, query (still streamed chunk by chunk), metadata, delete, bootstrap, transfer push/ack, MV backfill and handoff, region heartbeat, rehome, sync manifest, shard map, health probe, raft client-write.PeerRpcErrorkeeps "answered with status N" apart from "unreachable", so callers still act on 404/405/409/429/503 and 400/422 exactly as before. Headers and timeouts are unchanged.ConsensusPort(ports/consensus.rs) withRaftConsensus. It proposes locally, or forwards to the leader up to 3 times. The query service, scheduler, drain and leader callbacks use it.adapters/cluster/hinted_handoff_watcher.rs;PeerHttpgoes toadapters/cluster/peer_http.rs;ShardRoutingContext::peer_clientis removed.application/has no reqwest,PeerClientor Raft handle outside tests;ports/has no reqwest.Behaviour changes:
Known and not fixed here:
ok, as before.coordinator_fill_matches_region_fillandseries_cardinality_spans_regionsflake on "forward batch to node 2 ... timed out"; this reproduces on the base.Gate: fmt, clippy
-D warnings, lib 885, integration 373, CLI 54, all passing.