Skip to content

changes log is never pruned: add a retention step that calls store.PruneChanges #219

Closed

Description

@frostyard-machines

Gap

notesd's durable event log, the changes table, grows without bound. Every committed event adds a row (internal/store/store.go, Tx.Emit), and nothing removes rows.

Evidence

  • store.DB.PruneChanges (internal/store/changes.go) deletes all but the newest keep events, but only internal/store/store_test.go calls it.
  • The daily prune pass (internal/vault/manager.go, Manager.Prune) prunes versions (PruneVersions) and a hub's revisions (PruneRevisions, ADR-0019). It does not touch changes.
  • The rest of the system is already built for a pruned log: the table uses AUTOINCREMENT so that sequence numbers stay unique after pruning (internal/store/migrations/0001_init.sql), and events.subscribe answers resync when sinceSeq is older than the oldest retained event (internal/events/broker.go, OldestSeq; docs/specs/rpc-api.md, Subscription.resync).

Proposed step

Add a retention step to the daily prune pass that calls store.PruneChanges (by count, by age, or both), and record the retention rule in docs/design/vault.md. Things to settle:

  • The retention rule (for example, the newest N events or the last 30 days) and the cost of a resync for a client that was away longer.
  • Whether anything other than events.subscribe replays the log.
  • A test that runs the prune pass and checks that a subscriber older than the retained log gets resync.

PruneChanges stays in the store for this step (frostyard/frostnotes grooming, issue #213).

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions