Skip to content

Under frequent index builds the GC age guard, not max_old_indexes, decides retention #2164

Closed

Description

@bplatz

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_mins old.

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.

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

  1. added
    P2
    triage:needs-decision
    area:storage
    and removed
    triage:needs-decision
    on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2area:storage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions