mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 11:07:31 +01:00
* volume: keep a low-disk location read-only until free space is back by a margin The volume server checks each disk location once a minute and sets the location's low-disk flag from that reading alone. A disk whose free space hovers at -minFreeSpace (writes use space, deletes and vacuum give a little back) flips the flag on and off, and every volume on the location with it. The master hears each flip in a heartbeat, so it keeps assigning writes to volumes that are about to turn read-only, and the write fails with a read-only error. Nothing smooths this: the volume reads the location's flag directly, and the master's volume layout takes the heartbeat's read-only bit as it comes (its recovery delay and size band apply to full volumes, not to read-only ones). A location that went low now stays low until its free space is 1% of the disk above the limit, for a percentage limit and a byte limit alike (MinFreeSpace.IsLowFrom). Going low is unchanged. The margin is a constant, not a flag: what flips a disk at the limit within one check is a vacuum, a volume copy or the writes of one minute, each about one volume (30 GB by default) at most. 1% of a multi-TB disk is about that much, so a swing of that size does not clear the state, while an ordinary cleanup of a few volumes does. The disk check runs on one goroutine per location and is the only writer of the flag, so the previous verdict it reads cannot change under it; readers only load it. Every consumer of the flag (heartbeat max volume counts, read-only flags, volume allocation, EC shard placement) reads the same flag, so they all see the held state. The live checks of volume copy and preallocation, which read the disk instead of the flag, only ever refuse more than the flag does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: do not remember a low verdict from a reading without space values When statfs fails or times out before any good reading is cached, the disk status has All, Free and PercentFree at 0, and MinFreeSpace.IsLow calls that low. With the hysteresis, that verdict was remembered, so a later good reading between the limit and limit+1% kept the location read-only, where it used to clear it: a disk whose first check timed out stayed read-only until its free space cleared the margin. A reading without space values (All is 0) is now judged by IsLow alone, as before, and does not change the remembered verdict, which lives in its own atomic field that only readings with space values update. A failed reading between two good ones leaves the held verdict as it was. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): keep a low-disk location read-only until free space is back by a margin Mirror Go's MinFreeSpace.IsLowFrom: once a location goes low it stays low until free space is 1% of the disk above the limit, for percentage and byte limits alike. A failed statfs reading (total 0) already leaves the flag untouched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: trim the low-disk hysteresis comments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): test the low-disk hysteresis with fixed readings Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>