fix(dvr): catalog merge on restart + refuse raw-TS recording (D-1, D-2)#11
Merged
Conversation
…S recording - D-1: StartRecording rebuilt a fresh empty catalog and overwrote catalog.json on every restart, so retention (which iterates the catalog) never saw or pruned pre-restart hours — orphaned blobs, defeated retention, unbounded disk growth. Now LoadCatalog + mergePriorCoverage carries prior Hours/Available/Gaps (and removed-profile hours) into the new catalog. Retention is wall/size-anchored so it stays correct regardless of the per-run media origin; the new run anchors its own origin so recent timeshift keeps working. - D-2: a non-transcoded raw-TS source (UDP/HLS-pull/HTTP-TS/SRT/file) wrote TS chunks the blob writer can't ingest → recorded ZERO bytes while the status said 'recording'. blobProfiles now refuses the lane (fail loud) so no catalog/Recording row is created and the status never lies. Regression tests for both. Fixes audit findings D-1, D-2.
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes audit findings D-1 and D-2 (DVR data loss).
StartRecordingrebuilt an empty catalog and overwrotecatalog.jsonon every restart, so retention (iteratescat.Profiles[].Hours) never saw or pruned pre-restart hours → orphaned blobs, defeated retention, unbounded disk growth. NowLoadCatalog+mergePriorCoveragecarries priorHours/Available/Gaps(plus removed-profile hours) into the new catalog. Retention is wall/size-anchored so it's correct regardless of the per-run media origin; the new run anchors its own origin so recent timeshift keeps working. Cross-restart-boundary playback needs a per-hour reader anchor (noted follow-up).blobProfilesnow refuses the lane (fail loud) so no catalog/Recording row is created. Making raw-TS DVR actually record (wirepkt.TS) is a deliberate follow-up.Tests:
TestMergePriorCoverage,TestBlobProfiles_RefusesRawTSSource.go build,go test -race(dvr + coordinator),golangci-lintall green. Both findings flipped to ✅ in the audit report.