You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cluster: runners joining one after another move the same shard several times #10060
Base: effect 4.0.6 (effect/cluster, SqlMessageStorage + SqlRunnerStorage on PostgreSQL advisory locks). main has the same code.
What happens. Each runner recomputes assignments on every change to the healthy runner set. When N runners join
a few seconds apart (a rolling deploy, an autoscaler adding runners one by one), each join produces a new hash ring,
and a shard can move from A to B, then from B to C, within one scale event. Each move drains the shard's entities on
the old owner and replays them on the new one.
Repro.Handoff.test.ts: one runner with 24 shards; three more runners join 1.5 s apart. Track each shard's
owner. On 4.0.6, 9 shards move twice. Expected: each shard moves at most once.
Proposed fix (implemented on a fork, PR available).ShardingConfig.assignmentSettleWindow (default 0, the current behavior). After a runner joins,
recompute once the healthy set has been unchanged for the window, and at most four windows after the first change.
A runner leaving recomputes at once, so its shards are not left unowned. A runner with no assignments yet computes at
once.
Activity