Skip to content

retention: keep channel messages longer than other packets (retention.channelDays) #296

Description

@dborup

Problem

retention.packetDays prunes all transmissions older than N days. Channel messages (GRP_TXT, payload_type = 5) are transmissions too, so a channel's history disappears after N days.

The ingestor runs this prune at every startup ([prune] startup pruned N transmissions older than N days) and then once a day. To users it therefore looks as if a restart deletes channel messages. In fact a restart only removes, all at once, everything that has aged past packetDays since the last prune.

Deployments that keep a short packetDays to bound database size, for example 14 days, lose chat history that users expect to keep. Channel messages are a small fraction of all traffic, so keeping them longer is cheap.

Proposal

Add retention.channelDays (ingestor):

  • When it is set and greater than packetDays, the regular packet prune skips channel messages (payload_type = 5) younger than channelDays. A separate prune removes channel messages older than channelDays.
  • When it is 0 or unset, behaviour is unchanged: channel messages follow packetDays.
  • Observations of a kept channel message are kept with it, so the region filter and observer counts stay consistent.
  • Both prunes log separately, for example [prune] startup pruned N channel messages older than M days.

Acceptance

  • Test: with packetDays = 14 and channelDays = 90, a 30-day-old channel message and its observations survive the startup prune. A 30-day-old advert or other packet is pruned. A 100-day-old channel message is pruned.
  • Test: with channelDays unset or 0, behaviour is identical to today.
  • The kept channel messages still appear in GET /api/channels and /api/channels/{hash}/messages. These read SQL with full history, so no server change should be needed. Verify it.
  • Prune stays batched and efficient. The extra predicate must use the existing indexes; check with EXPLAIN QUERY PLAN. Measure it on a realistic fixture.
  • All writes stay in cmd/ingestor. No new map[string]interface{}.
  • The configuration docs and config.example.json describe the option. Note that the server's in-memory packet store window (packetStore.retentionHours) is independent of it.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions