Skip to content

chore(storage): audit blob GC lease design (pending_blob_refs / gc_generations) for retention #1000

Closed

Description

@Sinity

Context

While bringing #818 to honest closure, the audit comment that originally suggested these tables might be "unused" turned out to be incorrect: polylogue/storage/blob_gc.py actively uses both:

  • pending_blob_refs — lease acquire/release in acquire_lease / release_lease (blob_gc.py:213, 232) and lease check in _still_referenced (blob_gc.py:49)
  • gc_generations — generation tracking in _record_generation (blob_gc.py:180)

The actual question is therefore not "are these tables unused?" but "is the lease-based GC design itself still current, or has the daemon write-plan evolved past it?"

Decision needed

Confirm whether the blob GC strategy still relies on lease tables, or whether the convergence-loop / mark-and-sweep approach in storage/repair.py:repair_orphaned_blobs has fully replaced it. Specifically:

  • Are leases acquired anywhere outside blob_gc.run_blob_gc? (Search for callers of acquire_lease outside that module.)
  • Does the daemon's live ingest path coordinate via leases, or does it rely on raw_conversations.raw_id as the single source of truth (which is what detect_orphans queries)?
  • If leases are no longer load-bearing, document the dual-write cost and decide: keep as a safety net, or remove and simplify _still_referenced.

Acceptance criteria

  • Audit who calls acquire_lease / release_lease outside blob_gc.py itself
  • Document the current blob-GC concurrency model (lease-based vs. snapshot-based) in docs/architecture.md or docs/internals.md
  • Decide: retain tables and document their role, OR remove tables + simplify _still_referenced + drop the corresponding DDL fragment
  • Either outcome lands as a single PR; no half-removal

Why this is not in scope for #818

#818 is about orphan detection, integrity verification, and operator-visible cleanup. The lease design is a separate concurrency question that doesn't affect operator-visible behaviour.

Source

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

    area:storagetype:chore

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions