Migration 0007 (DDL only): delivery_log_days, a row per UTC day, kept a year, shown nowhere - read off a copy of the database after a month by the decision rule written in the audit plan. - reconcile_closed: the sweep adds the rows it actually closed. - reconcile_contradicted: store.UpdateStatus, in one transaction, counts the rows with reason "reconcile" a delivery line now speaks of, writes the log's status and clears the reason - so a re-read line counts once. - tailer_blind_seconds: follow() tracks stretches in which the file is gone or reopening fails (logtail.blindness); stored when a stretch ends and every minute while it lasts; under 3 s not counted (the rotation's tick between rename and create loses nothing). - queued_over_lifetime: every sweep overwrites the day's level with the rows queued past LongestLifetime + MaximalBackoff (a message Postfix still works on stays queued until its first retry after the lifetime). - retentionLoop prunes days older than a year. Tests: store (sums per day, the level overwritten, under a second nothing, prune; a contradicted sweep counted once and its reason cleared; count of queued rows); logtail (the sweep counts what it closed; countStuck records the level; blindness - a one-tick gap not counted, 75 s stored as 60 + 15 from where the last part ended). Schema tests at user_version 7. schema-migrations.md: chain head 7 (it still said 5 since 2.4.0), row 7. CHANGELOG [Unreleased], audit plan line ticked, roadmap 10/61. Evidence: go vet ./... clean; go test ./internal/store ok, ./internal/logtail ok but for TestFollowTailsAndRotates (Windows); the server run of the stage follows before the push. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
20 lines
1.1 KiB
SQL
20 lines
1.1 KiB
SQL
-- What the delivery log's own machinery did, a row per UTC day that has
|
|
-- something to say, kept a year (audit 2026-10-12, stage 1). These are the
|
|
-- numbers the reconcile sweep's fate is decided by; no page reads them, they
|
|
-- are read off a copy of the database. DDL only; nothing existing changes.
|
|
-- reconcile_closed rows the sweep closed as bounced (reason 'reconcile')
|
|
-- reconcile_contradicted rows closed by the sweep that a delivery line later
|
|
-- rewrote - the log wins, and is counted here
|
|
-- tailer_blind_seconds seconds the log tailer could not read mail.log
|
|
-- (the file gone, reopening it failing)
|
|
-- queued_over_lifetime rows still queued past Postfix's queue lifetime,
|
|
-- as measured by the day's last sweep (a level, not
|
|
-- a sum)
|
|
CREATE TABLE delivery_log_days (
|
|
day TEXT PRIMARY KEY,
|
|
reconcile_closed INTEGER NOT NULL DEFAULT 0,
|
|
reconcile_contradicted INTEGER NOT NULL DEFAULT 0,
|
|
tailer_blind_seconds INTEGER NOT NULL DEFAULT 0,
|
|
queued_over_lifetime INTEGER NOT NULL DEFAULT 0
|
|
);
|