lease: count compaction files in the retention cost note (#263)
Astra's review (P2): the estimate counted only seven snapshots, but retention keeps L1-L3 files back to the oldest kept snapshot. Worst case (most pages rewritten hourly) is ~200 database sizes, not 7. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Human
Prompt
Yes.
From this commit's own message. The prompt ledger has no entries for it — which is what a squashed, rebased or amended commit looks like, and what every commit looks like in a repo without a ledger.
Summary
Corrects the storage estimate in the retention comment.
1 file changed,
+13
−5
internal/lease/lease.go+13 −5
CI passed — run details
diff --git a/internal/lease/lease.go b/internal/lease/lease.go| index a9ab03ba5..1de6e5479 100644 |
| --- a/internal/lease/lease.go |
| +++ b/internal/lease/lease.go |
| @@ -73,12 +73,20 @@ var compactionLevels = litestream.CompactionLevels{ |
| // instance is awake, so each wake pruned every snapshot older than a day |
| // (#263), and `carlos db pull --at` reached back about a day. |
| // |
| -// A week is the deliberate choice: seven daily snapshots per database, of |
| -// files measured in megabytes, against S3 storage at ~$0.023/GB-mo. It adds |
| -// no requests: the snapshot monitor's cadence is SnapshotInterval either |
| -// way, and only how far back its deletes reach changes. Lengthen it if a |
| +// A week is the deliberate choice. It adds no requests: the snapshot |
| +// monitor's cadence is SnapshotInterval either way, and only how far back |
| +// its deletes reach changes. It does add storage, and more than the seven |
| +// snapshots: retention keeps every L1-L3 file (compactionLevels: hourly, |
| +// 6-hourly, daily) back to the oldest kept snapshot too. Each holds only |
| +// the pages that changed in its window, so a typical small, lightly |
| +// written database adds little. The worst case is a database rewriting |
| +// most of its pages every hour: about 168 L1 + 28 L2 + 7 L3 files plus 7 |
| +// snapshots, some 200 database sizes (100 MiB -> ~20 GiB, ~$0.50/mo at |
| +// ~$0.023/GB-mo), against about 30 under the old 24h. Lengthen it if a |
| // restore is ever wanted from further back than "we noticed within the |
| -// week". |
| +// week"; shorten it if the bucket's size says the worst case is common. |
| +// (Astra's review of #263 corrected an estimate that counted only the |
| +// snapshots.) |
| const ( |
| SnapshotInterval = 24 * time.Hour |
| SnapshotRetention = 7 * 24 * time.Hour |