Repository navigation
fix(redis): repair a damaged append-only file before Redis starts - #3531
Merged
Merged
Conversation
- Redis exits at startup on a bad record mid-AOF, and `restart: always` loops it forever, taking celery, the splash page and the viewer command bus down with it - New entrypoint checks the AOF on every start and runs `redis-check-aof --fix`, keeping everything before the bad record - If the AOF cannot be repaired, move it aside and seed a new one from the last RDB snapshot (Redis ignores dump.rdb when the AOF directory is missing), else start empty - Add redis-tools to the test image so the recovery tests run in CI Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
There was a problem hiding this comment.
Copilot encountered an error: Your billing is not configured or you have Copilot licenses from multiple standalone organizations or enterprises. To use premium requests, select a billing entity via the GitHub site, under Settings > Copilot > Features.
Co-authored-by: multica-agent <github@multica.ai>
There was a problem hiding this comment.
Copilot encountered an error: Your billing is not configured or you have Copilot licenses from multiple standalone organizations or enterprises. To use premium requests, select a billing entity via the GitHub site, under Settings > Copilot > Features.
|
vpetersson
approved these changes
Nov 28, 2026
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.



Issues Fixed
Fixes #3529
Description
When the AOF's incr file has a bad record in the middle (for example after a power cut or a failing card), Redis exits at startup with
Bad file format reading the append only file.restart: alwaysrestarts it straight into the same failure, so the player loses its Celery broker, Channels layer and viewer command bus until someone repairs the file by hand.This adds
docker/redis/entrypoint.shas the Redis image'sENTRYPOINT. TheCMDis unchanged. On every start the entrypoint:redis-check-aofon the manifest. This takes milliseconds on an AOF this size, and a healthy or missing AOF is left untouched.redis-check-aof --fix. That truncates the file at the first bad record and keeps everything before it, including the telemetrydevice_idthis image persists the AOF for.appendonlydirtoappendonlydir.corrupt, keeping only the latest copy, and seeds a new AOF fromdump.rdbifredis-check-rdbaccepts it. This seeding matters: Redis 7+ withappendonly yesignoresdump.rdbwhen the AOF directory is missing, so moving the AOF aside alone would start an empty dataset. If no snapshot is usable, Redis starts empty.redis-toolsprovides both check tools. It is already a dependency ofredis-serverin the runtime image and is now added to the test image so the new tests run in CI.Testing
tests/test_redis_entrypoint.pydrives the script against real on-disk layouts with the real check tools: healthy, mid-file corruption, unrepairable AOF with and without a snapshot, repeated failures, and a first boot with no data. Four of these tests fail with a pass-through entrypoint.anthias-redisimage with this entrypoint mounted: a corrupted incr AOF makes the shipped image exit 1 withBad file format. With the entrypoint, the AOF is repaired, Redis reachesReady to accept connections, and the seededdevice_idsurvives.Checklist
🤖 Generated with Claude Code