Repository navigation
Description
Environment
- Fluree 4.1.3 official release binary (
fluree-db-cli-aarch64-unknown-linux-gnu), single node, file storage, Docker (Ubuntu 24.04) FLUREE_REINDEX_MIN_BYTES=2000000(results are worse with the 4.1.x default of 100 bytes — see "Aggravating factor" below)- Workload: sustained ingest of many small commits (JSON-LD inserts +
where/delete/insertupdates, idempotent re-asserts), ~4,100 commits / ~1.2M flakes over ~1h
Observed
After the ingest run, the ledger directory holds 3.0 GB for 52 MB of actual commit data (~60× amplification, ~98% of it superseded index artifacts):
@shared/dicts/ 1.8G (~2,400 .dict files — every dictionary version ever uploaded)
main/index/objects/ 1.1G (2,455 leaves + 860 branches)
main/commit/ 52M (the actual data)
main/index/roots/ 216 roots (~1 per background build — none ever deleted)
main/index/garbage/ 212 garbage manifests (present but never acted on)
Between a 48-commit sample and the full run the on-disk size grew super-linearly (~6 MB → ~3 GB for 28× the commits, exponent ≈ 1.85): each background build re-uploads dictionaries whose size is O(ledger), and none of the superseded artifacts are ever reclaimed.
Per the docs (docs/indexing-and-search/background-indexing.md, "Index Retention"), cleanup should be performed by the binary-index GC with defaults gc_max_old_indexes=5, gc_min_time_mins=30. In our run, zero roots were ever deleted (216 remain for ~215 builds), including:
- during the ingest itself (final ~30 min of the run had many chain entries past both retention and age thresholds),
- after fresh incremental builds triggered post-run (which per
orchestrator.rsspawnclean_garbageon publish), - after
POST /v1/fluree/reindex(HTTP 200, new consolidated root) — disk usage unchanged, roots count increased.
Root cause (one of them, code-verified)
POST /v1/fluree/reindex publishes its FIR6 root with no garbage manifest:
fluree-db-indexer/src/build/rebuild.rs(~line 1128):encode_and_write_root_v6(..., None /* GC chain deferred for V3 milestone */, ...)fluree-db-indexer/src/gc/collector.rs(~line 149): the prev-index chain walkbreaks at any entry without a garbage manifest ("No garbage manifest in index, stopping GC" — conservative by design).
Consequence: after any reindex, every older root (and every leaf/branch/dict blob only they reference) sits behind the manifest-less root and is permanently unreachable for GC — the retention policy can never truncate past it. The reindex docs (docs/indexing-and-search/reindex.md, step 6: "Spawns async garbage collection to clean up old index versions") currently describe behavior the published root makes impossible.
Independent of the reindex issue, the ingest-time GC also reclaimed nothing in our run despite 212 garbage manifests being present and age/retention thresholds being exceeded; we don't have a root cause for that part (no GC warnings in logs at info level), but the artifact counts above are easy to reproduce.
Impact
Continuous-ingest single-node deployments grow without bound: disk is dominated by superseded dictionary and index versions that no available mechanism reclaims. There is no manual lever either — no GC/compaction HTTP endpoint (/reindex rebuilds but does not reclaim), and no CLI flag on fluree server run.
Practical impact on our project: a modest real-world corpus (1,626 captures of betting-odds observations, 52 MB raw) is unusable for continuous operation on a single node; we currently plan periodic ledger rotation (fresh ledger + bulk re-import) purely to work around this.
Repro sketch
fluree server run(file storage),FLUREE_REINDEX_MIN_BYTES=2000000.- Loop ~1–4k small transactions (a few KB each: some fresh inserts, some
where/delete/insertupdates, some idempotent re-asserts of existing@ids). - Watch
ledger/main/index/roots/and@shared/dicts/— counts grow ~1 per build, nothing is ever deleted (even ≥30 min later,gc_max_old_indexesdefault 5). POST /v1/fluree/reindex→ 200, new root;duunchanged; from this point the GC chain is provably broken (root has no garbage manifest → collectorbreaks).
Suggestions
- Reindex roots should participate in the GC chain: either emit a garbage manifest for the superseded chain, or mark the root as an explicit chain-reset that makes everything older immediately collectible (it is a full consolidated snapshot; nothing older is needed for queries after publish, aside from time-travel retention policy).
- Fix/verify ingest-time reclamation so the documented
gc_max_old_indexes/gc_min_time_minsretention actually truncates the chain under sustained small-commit load (dictionaries included —@shared/dictsis the bulk of the leak). - Expose a manual GC/compaction admin endpoint (or a
flureeCLI subcommand usable against a stopped server) so operators can reclaim space deterministically.
Aggravating factor (separate but related)
The 4.1.x default reindex_min_bytes is 100 bytes (fluree-db-api/src/server_defaults.rs, changed from 100 KB in 8ad4f65a), i.e. a background build after essentially every commit. Combined with the non-reclamation above, default-config small-commit workloads produce an index build (and a new dictionary upload) per transaction — we measured 25 GB / 34k files for ~370 small captures on 4.1.2 defaults. If the leak is fixed this default may still deserve a second look for write-heavy workloads.
Activity
IX-Erich commentedon Aug 1, 2026
Confirming this is biting me (hard) too.
add an offline index-version graph diagnostic