ADR-00048: The composite store stops writing to its local tier below a free-space floor¶
| Field | Value |
|---|---|
| Status | accepted |
| Date | 2026-12-02 |
Context and Problem Statement¶
A composite store writes what it reads, stores and copies to its local tier, whatever the free space on the tier's volume. The local store frees space only through compaction, which must write index and packfile copies before it truncates anything. A burst of writes can fill the volume faster than a compaction pass frees it. Once the volume is full, compaction cannot write, frees nothing, and the store stays full until someone frees space by hand.
How should a server keep its local tier's volume from filling up?
Decision Drivers¶
- A write to the local tier is a cache write: the durable store holds the data, so skipping one costs speed, not correctness.
- Compaction must keep the space it needs to run.
- The check runs on every cache write, so it must cost no system call.
- Compaction and the local store keep their own rules.
Considered Options¶
- The composite store skips local writes below a floor read from the server's disk monitor
- The local store refuses every write below a floor
- A ballast file the compactor releases when the volume is full
Decision Outcome¶
Chosen option: "The composite store skips local writes below a floor read from the server's disk monitor", because it stops the writes that fill the volume and leaves compaction free to use what is left.
The server's local store monitor records the free space of the volume holding the composite
store's local tier in a shared FreeSpace reading at each check. The composite store reads it
once for each local write, when it schedules the work that leads to the write, such as a query's
metadata fill. Below local_cache_min_free_bytes it skips the write and counts it as
low_space. A copy's recording task still runs for the write replicas. Writes start again once
free space reaches the floor plus a tenth. A write that started runs to the end, and a missing
reading lets writes go ahead.
Writes that peers send are excluded: puts that other nodes replicate here, and the internal QUIC local-store operations, write to the local store without passing through the composite store, so the floor does not stop them. Replication between regions keeps multi-region reads fast, so it keeps running however full the volume is.
Consequences¶
- Good, because the volume keeps the floor free for compaction.
- Good, because the check is two atomic loads.
- Bad, because the reading is as old as the check interval, so the floor has to cover what a burst writes in one interval as well as one compaction step.
- Bad, because files outside the store, such as logs, can still fill the volume.
- Bad, because writes from peers can still fill the volume.
- Neutral, because reads miss locally until free space returns, and go to replicas and the durable store.
Pros and Cons of the Options¶
The local store refuses every write below a floor¶
- Good, because it protects every writer of the store, not only the composite store.
- Bad, because the local store cannot tell a cache write from a durable one, or from the writes compaction needs, so a refused compaction write leaves the volume full.
A ballast file the compactor releases when the volume is full¶
- Good, because it frees space whatever filled the volume.
- Bad, because cache writes take the space it releases unless they also stop at a floor.
More Information¶
Implemented in lore-revision/src/store/composite/local_cache_gate.rs and
lore-server/src/util/local_store_monitor.rs.