Continuous rollover storage retention policy (NVR-style recording) #22205
Closed
iamrans0m00
started this conversation in
Ideas
Replies: 1 comment 2 replies
-
|
It is worth noting that this can already be accomplished by setting a ridiculously high retain |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
Currently Frigate requires users to set explicit retention days (
continuous.days,motion.days) for recordings. This works well when you know your storage capacity and camera bandwidth, but many users coming from traditional NVR systems expect a simpler model: record until the disk is full, then overwrite the oldest footage.This has been requested in #9275 and attempted in #21494, but the previous approach ran into several design issues that were raised by maintainers.
Proposed Solution
A new global config option
retain_policywith two modes:time(default): Existing behavior — recordings expire after configured days. No changes.continuous_rollover: Recordings fill available disk space. When space runs low,StorageMaintainerreclaims space using prioritized deletion.How This Addresses Previous Concerns (#21494)
The maintainer feedback on #21494 raised three specific issues. Here's how this proposal handles each:
1. Per-camera vs global confusion
#21494 added
max_sizeper-camera, making global behavior unintuitive. This proposal makesretain_policystrictly global-only — it's a system-wide mode switch, not a per-camera setting. It's hidden from per-camera config in the UI.2. No deletion priority between segment types
#21494 had no logic for deciding which recordings to delete first. This proposal implements three-tier prioritized deletion in
StorageMaintainerwhen in rollover mode:retain_indefinitelyevents, emergency onlyClassification uses the same sorted two-pointer overlap algorithm already used in
RecordingCleanup, with camera-scoped review segment checking.3. Mixing days + size retention
#21494 layered
max_sizeon top of the existing days system, requiring users to configure both. This proposal makes it an either/or mode switch — in rollover mode,continuous.daysandmotion.daysare explicitly ignored (with a config warning). Only alert/detection retention days still apply for event clip aging. Users don't need to think about both systems.Implementation Details
RetainPolicyEnum(time|continuous_rollover) onRecordConfigRecordingCleanupskips time-based expiry in rollover mode (review segment expiry still runs)StorageMaintainergets a new_reduce_storage_rollover()method with the three-tier deletion logic/api/recordings/storage/breakdownendpoint categorizes storage into overwritable/event-retention/protectedtimepolicy code path is completely untouchedI have a working implementation with tests in #22204. Happy to adjust the approach based on feedback.
Config Example
Beta Was this translation helpful? Give feedback.
All reactions