-
Notifications
You must be signed in to change notification settings - Fork 23.6k
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
[BUG] Complete data loss when enabling AOF through config #12484
Comments
Wish you can get a response from the official |
@threema-danilo Please see the comments in the redis.conf
If you want to change from RDB to RDB+AOF, you should first use |
That comment tells me that the AOF file will be loaded. Since the name of the mode to be used is "RDB+AOF", my expectation was that the AOF file will be loaded in addition to the RDB file. Furthermore, the comment says that the AOF file will be loaded, not that the RDB file will be truncated (leading in data loss even when switching back to AOF=off). In case this is the expected and desired behavior: Would a documentation PR be welcome, which adds some warning notes about it? |
@threema-danilo Converting from rdb to rdb+aof already exists in the link How I can switch to AOF, if I'm currently using dump.rdb snapshots?, not sure if we need to repeat it in the conf. |
@threema-danilo any documentation PR (considering it's short, clear and improves the current state) is welcome. |
The two documentation PRs are here:
I think these notes would already help a lot. Having some kind of support for detecting the previous persistence type after a restart and automatically converting the data would be better of course (from a user point of view), but now at least it's clearly documented. |
Add warning about RDB to AOF conversion and some other improvements to that documentation section. Removed section for Redis < 2.2. Related to redis/redis#12484.
Describe the bug
Given a Redis 7 server that was started with defualt parameters, when stopping it and starting it with
--appendonly yes
, all data is gone.To reproduce
Start Server:
Connect to server and write data:
Stop server, and restart it with
--appendonly yes
:Reconnect to server, look at existing keys:
The data is now gone. It remains gone when restarting the server again without
--appendonly yes
.Expected behavior
From reading through https://redis.io/docs/management/persistence/, my understanding of AOF+RDB is that the AOF is like a "journal" that contains writes since the last RDB snapshot. So when enabling AOF, the old RDB file should still be read, and no data should be lost (or that the data is being automatically converted). That understanding is probably wrong. However, the documentation does not seem clear enough about this.
In the documentation section "How I can switch to AOF, if I'm currently using dump.rdb snapshots?", there are instructions on how to switch a live instance to AOF. However, I understood this as a way to upgrade the database without any downtime. I did not see an indication that stopping the server and changing the config would lose the data.
In the same section, there is this phrase:
The warning is that the configuration changes will be lost. There is no word about data loss.
I would expect that either Redis can handle configuration changes from RDB to RDB+AOF without data loss, or that there is a clear warning in the documentation that hints at this behavior.
(Potentially related: #972)
The text was updated successfully, but these errors were encountered: