{"record":{"id":"fc19ce1e110f9089","repo":"thanos-io/thanos","slug":"5m-resolution-retention-must-be-higher-than-the-mi","errorCode":null,"errorMessage":"5m resolution retention must be higher than the minimum block size after which 1h resolution downsampling will occur (10 days)","messagePattern":"5m resolution retention must be higher than the minimum block size after which 1h resolution downsampling will occur \\(10 days\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/thanos/compact.go","lineNumber":423,"sourceCode":"\t}\n\n\tretentionByResolution := map[compact.ResolutionLevel]time.Duration{\n\t\tcompact.ResolutionLevelRaw: time.Duration(conf.retentionRaw),\n\t\tcompact.ResolutionLevel5m:  time.Duration(conf.retentionFiveMin),\n\t\tcompact.ResolutionLevel1h:  time.Duration(conf.retentionOneHr),\n\t}\n\n\tif retentionByResolution[compact.ResolutionLevelRaw].Milliseconds() != 0 {\n\t\t// If downsampling is enabled, error if raw retention is not sufficient for downsampling to occur (upper bound 10 days for 1h resolution)\n\t\tif !conf.disableDownsampling && retentionByResolution[compact.ResolutionLevelRaw].Milliseconds() < downsample.ResLevel1DownsampleRange {\n\t\t\treturn errors.New(\"raw resolution must be higher than the minimum block size after which 5m resolution downsampling will occur (40 hours)\")\n\t\t}\n\t\tlevel.Info(logger).Log(\"msg\", \"retention policy of raw samples is enabled\", \"duration\", retentionByResolution[compact.ResolutionLevelRaw])\n\t}\n\tif retentionByResolution[compact.ResolutionLevel5m].Milliseconds() != 0 {\n\t\t// If retention is lower than minimum downsample range, then no downsampling at this resolution will be persisted\n\t\tif !conf.disableDownsampling && retentionByResolution[compact.ResolutionLevel5m].Milliseconds() < downsample.ResLevel2DownsampleRange {\n\t\t\treturn errors.New(\"5m resolution retention must be higher than the minimum block size after which 1h resolution downsampling will occur (10 days)\")\n\t\t}\n\t\tlevel.Info(logger).Log(\"msg\", \"retention policy of 5 min aggregated samples is enabled\", \"duration\", retentionByResolution[compact.ResolutionLevel5m])\n\t}\n\tif retentionByResolution[compact.ResolutionLevel1h].Milliseconds() != 0 {\n\t\tlevel.Info(logger).Log(\"msg\", \"retention policy of 1 hour aggregated samples is enabled\", \"duration\", retentionByResolution[compact.ResolutionLevel1h])\n\t}\n\n\tvar cleanMtx sync.Mutex\n\t// TODO(GiedriusS): we could also apply retention policies here but the logic would be a bit more complex.\n\tcleanPartialMarked := func() error {\n\t\tcleanMtx.Lock()\n\t\tdefer cleanMtx.Unlock()\n\n\t\tcompact.BestEffortCleanAbortedPartialUploads(ctx, logger, sy.Partial(), insBkt, compactMetrics.partialUploadDeleteAttempts, compactMetrics.blocksCleaned, compactMetrics.blockCleanupFailures, ignoreDeletionMarkFilter.DeletionMarkBlocks())\n\t\tcompactMetrics.cleanups.Inc()\n\n\t\treturn nil\n\t}","sourceCodeStart":405,"sourceCodeEnd":441,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/cmd/thanos/compact.go#L405-L441","documentation":"A configuration validation error in runCompact (cmd/thanos/compact.go:423). When downsampling is enabled and a 5m retention is set, it must be at least downsample.ResLevel2DownsampleRange (10 days); otherwise 1h downsampling could never persist for those blocks, so startup is aborted.","triggerScenarios":"--downsampling.enabled plus --retention.5m set to a nonzero duration less than 10 days (e.g. 96h).","commonSituations":"Tuning 5m retention to a few days while downsampling is enabled; copying retention configs between clusters with different downsampling settings.","solutions":["Increase --retention.5m to at least 10 days (e.g. --retention.5m=240h)","Pass --downsampling.disable if short 5m retention is intentional","Set --retention.5m=0s to disable 5m retention, bypassing the check"],"exampleFix":"// before\nthanos compact --retention.5m=96h ...\n// after\nthanos compact --retention.5m=240h ...\n// or\nthanos compact --downsampling.disable --retention.5m=96h ...","handlingStrategy":"validation","validationCode":"ret5m := time.Duration(conf.retentionFiveMin)\nif ret5m != 0 && !conf.disableDownsampling && ret5m < 10*24*time.Hour {\n\treturn errors.New(\"--retention.5m must be >= 10d when downsampling is enabled\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep 5m retention >= 10d when downsampling is enabled","Validate the full retention ladder (raw >= 40h, 5m >= 10d) in CI for config changes","Prefer disabling downsampling explicitly rather than short retentions"],"tags":["thanos","configuration","retention","downsampling"],"backgroundTag":"invalid-config-value","analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}