Route one aggregate id's commands to one node on a cluster (evoq#8) #9
Loading…
Reference in a new issue
No description provided.
Delete branch "venus/8-route-one-node"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refs #8
On a cluster, all commands for one aggregate id run on one node, its owner. Each registry joins the pg group
evoq_nodes, and the owner is picked from the live nodes by rendezvous hashing. When the owner's node is lost, the id moves, and the retry does not apply the command twice. One node owns every id, so standalone runs the path it always did.evoq_aggregate_registry:owner/1,owner_of/2,live_nodes/0.get_or_start/3answers the owner's aggregate and starts it there if needed, with at most one hop.evoq_command_router: an owner node that went away ({nodedown, _}, or a remote aggregate'sshutdown) is retried withinretry_attemptsand markedowner_lost.evoq_aggregate:execute_command_with_state/3: anowner_lostretry first reads the stream's last events (owner_lost_lookback, default 100). A command that one of them names as itscausation_idis answered{ok, Version, [], State}with nothing appended. No other command makes that read.Tests:
evoq_aggregate_nodes_SUITE, real peers with one shared store stand-in, 2 and 3 nodes: the owner is the same on every node, one runner per id with zero store conflicts, an owner halted or stopped mid-traffic, and an owner that appended and died before replying. Unit:evoq_aggregate_owner_tests,evoq_aggregate_seen_command_tests. Five mutants on the routing choice are each killed by the peer suite.Local, OTP 28: compile, lint, eunit 376/376, ct 71/71, proper, and the dialyzer ratchet (no finding outside the baseline). The peer suite passed 3 runs out of 3.
Landed by fast-forward: main is
9ee5943f51(from56755af1). This repository does not allow the manually-merged style, so the PR is closed by hand.Pull request closed