Skip to content

GC's completion log reports retained_count as the retention target, not the versions left #2163

Closed

Description

@bplatz

At the end of a pass, clean_garbage logs "Garbage collection complete" with retained_count = keep_count (fluree-db-indexer/src/gc/collector.rs:633). keep_count is 1 + max_old_indexes (:430), which is 6 with the defaults on every pass. It is the retention target, not a count of anything.

The real number is usually much larger:

  • The walk (:454) runs oldest-first.
  • It stops at the first garbage record younger than min_time_garbage_mins (load_manifest_nodes, :225).
  • Every version newer than that point survives.
  • Under frequent builds, that is far more than keep_count.

The chain length only appears in a debug! line (:419). So an operator sees retained_count=6 at info level while storage holds dozens of versions. That is how this was reported.

A second gap makes the same state invisible from the other direction. The info line is skipped when nothing was collected (:624). A ledger whose every pass is stopped by the age guard therefore logs nothing at default level.

Line numbers are on main at aa9aa7acd. On next the log line is at collector.rs:620, and the logic is the same.

Fix

  • Log the versions actually left after the pass, retained: the chain length minus indexes_cleaned.
  • Log the target separately, as retention_target.
  • Add retained to CleanGarbageResult (gc/mod.rs:218).
  • Emit the line, or a debug! → info! counterpart, when the age guard stopped the walk with versions past the target, and include the count past the target.
  • Update tests that assert on the result struct.

Activity

  1. added
    bug
    P3
    area:storage
    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

    P3area:storagebug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions