You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Garbage reconciliation re-lists every file and re-reads all history each step, so it can't run in the background on large ledgers #2334
Garbage reconciliation finds the commit and transaction files that no branch references and no garbage record names yet: files a writer left when it crashed, leftovers from history rewrites such as rebases, and files from before collection existed. It records them as garbage, and collection deletes them.
It already works through the digest space a slice at a time and saves its progress between steps (fluree-db-api/src/garbage/reconcile.rs). But each step lists every file of the ledger again, and streams every branch's whole history again to decide its slice. On a ledger with millions of files, one step runs past the garbage pass's 30-second budget.
That is why background reconciliation is off by default (--garbage-reconcile-interval-secs, default 0; see docs/operations/configuration.md). Until an operator reconciles explicitly (Fluree::reconcile_garbage), or an erasure's purge reconciles the ledger it needs, those orphaned files stay on storage. It is a storage leak, not a correctness problem: garbage already recorded (released envelopes, rebase leftovers) is collected either way.
Proposal
Make a step's cost proportional to its slice:
Listing: page through the ledger's files with a cursor saved in the reconciliation's progress record, instead of listing everything each step.
References: read history incrementally, for example by recording how far each branch's history was already checked and streaming only what is new, or by checking a slice against a reference set persisted when the reconciliation starts.
Once a step fits the budget at millions of files, background reconciliation can be enabled by default.
Test
A reconciliation of a ledger whose file count needs many slices completes over several budgeted passes with each step under the budget, and finds the same garbage as one unbudgeted run.
Also from #2280's open items, in the same area: page or stream the garbage listings, so millions of files never sit in one list_prefix result in memory. And avoid streaming each branch's history again for every reconciliation slice. On durable storage, separate CPU contention from deletion I/O in the cost of a heavy pass; whole-run results at the five-minute cadence were measured on NVMe.
Activity
bplatz commentedon Nov 11, 2026
Also from #2280's open items, in the same area: page or stream the garbage listings, so millions of files never sit in one
list_prefixresult in memory. And avoid streaming each branch's history again for every reconciliation slice. On durable storage, separate CPU contention from deletion I/O in the cost of a heavy pass; whole-run results at the five-minute cadence were measured on NVMe.