-
Notifications
You must be signed in to change notification settings - Fork 23.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert RDB to AOF on boot when appendonly on
for the first time
#2574
base: unstable
Are you sure you want to change the base?
Conversation
…sing file for upgrade case
…ting RDB file and convert to appendonly
Hello!
|
Maybe, but I think it makes sense for another PR. I think most users will want to upgrade from RDB (legacy) to AOF (new) so that's the case I wanted to optimize for. It's also much easier to deal with, because you can trigger it only when appendonly.aof is missing. When switching back from AOF -> RDB, it is much more complicated because both files will exist and it's impossible to tell which one to prefer just based on timestamps. For instance if someone has both I think the sanest approach is probably to print a WARNING or maybe even ERROR and exit if you boot redis with |
@tmm1 excellent suggestions, I agree. Thanks. Conceptually the feature is accepted, I'll review it in detail and will merge into unstable. If back porting is viable, I'll backport to 3.0 since it is an operational improvement. |
Great, thanks. FWIW we have backported this patch to 2.8 (applies cleanly as-is) and are using it successfully. |
|
Fixes the issue in #837 where data loss will occur if you restart redis-server to turn
appendonly on
via redis.conf, without first callingredis-cli config set appendonly on
on the running instance before restarting.With this PR, redis-server will detect and perform the migration automatically on boot when a)
appendonly on
in the config (i.e.server.aof_state == REDIS_AOF_ON
) and b)appendonly.aof
does not exist on disk (i.e.redis_stat(server.aof_filename) == -1 && errno == ENOENT
).cc @antirez