Conversation
A stage timeout was read after its context had been replaced by the live parent, so the rolloff loop stored a failure and waited an hour.
The archive turn only checked the clock between batches, so one slow read could keep the card busy until it finished. The stage context now ends with the budget, and the hourly rollup waits for the history writer only inside that budget.
Member
Author
|
Superseded by #1341, which is merged. The live path keeps the ledger and chart buckets in SQLite and does not archive raw polls. |
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.
Large histories made maintenance repeatedly scan the same data, restart interrupted archive work and hold full backups behind a non-cancellable mutex. On the affected Raspberry Pi, dashboard retention timed out while live commits continued and the 6.7 GB history database retained roughly 161 million old samples.
Archive jobs now commit their input/prune cursor with bounded scratch batches, resume after cancellation or restart, and yield between stages. Publication still requires full readback verification; resumed pruning checks the published file hash and matches source values. Timestamp and staging-key seeks avoid repeated scans, and dashboard pruning uses its existing expiry index. Legacy archive sealing retries reader contention and rechecks late input outside the short write budget. Full backup pauses maintenance, honours cancellation through copying and verification, and removes the fixed per-batch delay that alone exceeded its deadline on this dataset. API/UI report actual processed records, phases and failures.
This keeps the current SQLite and Parquet design and aggregate retention policy: recent detail, minute summaries for 30 days, then five-minute summaries through the existing retention period. FTW is a dependable local EMS record; indefinite raw history belongs in an optional external system. No database engine, retention setting or TSDB service is added.
Validation:
make verifypassed; all 643 web tests passed. CI oncc76839dis green: 13 successful checks, three scoped checks skipped.The local pilot package preserves the already installed charging-evidence work from #1337. This PR targets master and does not include that independent work. It does not merge or publish a release. Live pilot evidence (21 September):
v0.131.0-beta.1+history.cc76839d, integration commitea5891ce; original package remains available for rollback.Homelab night, 21–22 September
The pilot kept
history.dbat 6,731,206,656 bytes. Five maintenance turns hitcontext deadline exceededand then waited an hour, because the stage budget was cancelled and replaced by the live parent context before the result was read. The rolloff loop treatsfailedas the hourly schedule andpendingas five seconds.d2f98e50reads the stage context before that replacement. A spent dashboard or archive budget stayspendingand the loop resumes. A dashboard bucket that cannot commit inside its own write budget still fails. Checked withTestHistoryMaintenanceBudgetStaysPendingand the existing archive, health and rolloff tests. The running homelab package is stillcc76839d.