Repository navigation
Description
GC collects an index version only when both conditions hold:
- it is past
max_old_indexes; - its successor's garbage record is at least
min_time_garbage_minsold.
This is documented in fluree-db-indexer/src/gc/mod.rs:98-111 and docs/operations/configuration.md. Under sustained writes the age guard decides retention, and max_old_indexes bounds nothing. At the 15-minute default:
| Build interval | Versions retained | Target |
|---|---|---|
| 5 s | ~181 | 6 |
| 30 s | ~31 | 6 |
#1601 added hard_max_old_indexes (--gc-hard-max-old-indexes / FLUREE_GC_HARD_MAX_OLD_INDEXES), which collects past a version count regardless of age. It left that ceiling unset by default on purpose: the age guard is the only thing protecting a query that started against an older root. A default ceiling would give that protection up on exactly the fast-publishing ledgers it would help. The docs tell operators to set it "well above the versions published during your longest query".
This was reported again from a materialize workload:
- each incremental build writes ~550 objects;
- dictionaries dominate the disk;
- retention follows the 15-minute rule.
The per-build cost belongs to #1636. This issue is only the retention side.
Decision needed
1. Keep it opt-in. This makes the default "however many versions fit in 15 minutes". If so, the operations docs should lead with the ceiling for write-heavy ledgers rather than list it as one row of a table.
2. Replace the time guard with reader tracking. GC would skip only roots that an open query still holds, and a count bound could then be on by default.
- In one process, this is a registry of in-use root CIDs, held by the snapshot a query reads. Two processes can open one file storage root without error; lock it for the Python package and the standalone server #2040 makes one process per storage root the supported shape.
- Raft followers and other readers of shared storage would need something like the nameservice lease in Build lease in the nameservice, so the storage sweep is safe across processes #1635.
- The age guard would remain only as a fallback for readers the registry can't see.
3. Tie the guard to query_timeout_ms. The docs already say to keep min_time_garbage_mins above the longest query. A ceiling derived from the publish rate times the query timeout would at least bound versions where a timeout is set.
Option 2 is the one that removes the trade-off. Options 1 and 3 leave it in place.
Activity