fix: bd admin compact --older-than=0 now expires all tombstones

Previously, --older-than=0 was indistinguishable from "flag not set"
because both resulted in compactOlderThan==0. The check `> 0` treated
both as "use default 30 days".

Fix:
- Change flag default to -1 (sentinel for "use default")
- Treat 0 as "expire all tombstones" by passing 1ns TTL
- Explicit positive values work as before (N days)

Closes bd-gigi

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-30 00:00:25 -08:00
parent cb69f1c154
commit 160feb95ea
2 changed files with 10 additions and 4 deletions

View File

@@ -175,10 +175,16 @@ func previewPruneTombstones(customTTL time.Duration) (*TombstonePruneResult, err
func runCompactPrune() {
start := time.Now()
// Calculate TTL from --older-than flag (0 means use default 30 days)
// Calculate TTL from --older-than flag
// -1 (default) = use 30 day default, 0 = expire all, >0 = N days
var customTTL time.Duration
if compactOlderThan > 0 {
customTTL = time.Duration(compactOlderThan) * 24 * time.Hour
if compactOlderThan >= 0 {
if compactOlderThan == 0 {
// --older-than=0 means "expire all tombstones"
customTTL = 1 * time.Nanosecond
} else {
customTTL = time.Duration(compactOlderThan) * 24 * time.Hour
}
}
if compactDryRun {