Skip to content

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

Closed

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

  1. added
    enhancement
    type:feature
    on Oct 6, 2026
  2. added a commit that references this issue on Oct 6, 2026
  3. dborup commented on Oct 6, 2026

    @dborup
    OwnerAuthor

    Fixed by #299 (merged as c713e32a2505cb294d1578213cad9ef5df8d449a). New opt-in retention.channelDays keeps channel messages (payload_type 5) longer than packetDays; it has no effect until set in config.

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

    enhancementtype:feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions