#11429·seaweedfs

Vacuum reclaims space but not slots: empty collection-bound volumes are never released, so a store with 99% free disk refuses all writes to other collections

Author: vic6996-webCreated Sep 22, 2026Updated Sep 22, 2026

Summary

The automatic vacuum sweep reclaims bytes but never reclaims slots. Volumes that end up completely empty stay registered to their collection forever, and because volume growth is gated solely on slot count, a store can sit at ~99% free disk and still refuse every write to any other collection.

Why slots are the scarce resource

AvailableSpaceFor is the only gate on growth, and it counts slots, not space:

https://github.com/seaweedfs/seaweedfs/blob/master/weed/topology/node.go#L308-L313

go
func (n *NodeImpl) AvailableSpaceFor(option *VolumeGrowOption) int64 {
    freeVolumeSlotCount := t.maxVolumeCount + t.remoteVolumeCount - t.volumeCount
    freeVolumeSlotCount -= ecShardSlots(t.ecShardCount)
    return freeVolumeSlotCount
}

There is no free-disk check anywhere in the path, so -max is the only thing preventing a volume server from filling its filesystem. That makes it impossible to set -max generously as a workaround: it is load-bearing.

An empty volume therefore is not merely untidy — it permanently consumes the single limited resource, and since volumes are collection-bound it can only ever be used again by its own collection.

Reproduction

-volumeSizeLimitMB=257, -max=100, one collection (bucket1) via the S3 gateway.

  1. write 23000 objects of 1 MB into bucket1 -> 89 volumes created, Free 100 -> 10
  2. delete all 23000 objects, keep the bucket
  3. wait for the automatic sweep (or force one)

Observed after the sweep completed:

volumes registered to bucket1      89
bytes held in those volumes         0
disk used                        592 MB  of 28 GB
master Free slots                   0 / 100

and then:

CreateBucket newbucket                    OK    0.00s
PutObject 5 bytes -> newbucket            500   0.94s   InternalError

master log: failed to find writable volumes for collection:newbucket

The 5-byte write keeps failing indefinitely. Re-probed every 2 minutes for 20 minutes: Free never moved off 0. Restarting the whole cluster does not help either — the empty .dat files are re-scanned on startup and re-registered to the same collection, so the slots are taken again immediately.

The only recoveries are deleting the owning bucket, or running volume.deleteEmpty by hand:

volume.deleteEmpty -quietFor=1m -apply   ->  deleted 84 volumes, 0.67s
Free 5 -> 89, and writes to the new bucket succeed

Suggestion

Have the automatic sweep drop volumes that are empty and have been quiet for N minutes — i.e. do what volume.deleteEmpty already does, but without requiring an operator to notice and intervene. Behind a flag (default off) would be fine.

Today volume.deleteEmpty exists but is manual-only and is never invoked by the sweep, so an unattended cluster degrades into this state and stays there.

Related but different

  • #7267 — asks that volume.deleteEmpty skip the compaction prerequisite for 100% garbage volumes. Complementary: that makes the reclaim cheap, this asks that it happen at all without manual action.
  • #10587 — same end symptom (one collection starving the others of slots) but a different cause: volumes that never fill, rather than volumes emptied by deletes.
  • #11428 — the 10 s dispatcher poll that makes each sweep take volumes x 10s.

Version

4.37, code unchanged on master at time of writing.