mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
b342e8f21fbfe3db69a05c68f4cdc789ac4e4b88
A freshly started volume reports ReadyForPrimary=false until its engine has a promotion fact, so any restart of the current primary failed over at the first heartbeat whenever a ready peer existed (#128; T1/T2). The controller now keeps the current primary while it is placeable and inside its boot grace: the grace starts at the first heartbeat of a new incarnation and lasts PrimaryBootGrace (the master sets it to its freshness window). Only its endpoint may be refreshed meanwhile. The grace never covers an explicit unhealthy report (unreachable, ineligible, withdrawn); ends for good once the replica reports ready or the grace expires (no extension by repeated not-ready heartbeats); and is refused to a replica with PrimaryBootFlapRestarts process starts within PrimaryBootFlapWindow (defaults 3 in 10 min). No incarnation (an older volume binary) means no grace. The promotion gate's direct reassign skips a current primary that is placeable by its own report and inside its boot grace. Lock order: grace state lives under TopologyController.mu, written only by observeIncarnationsLocked inside the existing snapshot path; the controller calls nothing outward while holding it. The gate calls PrimaryInBootGrace (takes c.mu) holding no controller-visible lock, the same direction as its existing controller calls. Fixes #128 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Languages
Go
84.5%
Rust
7.9%
Shell
2.7%
templ
1.6%
Java
1%
Other
2%