diff options
author | antirez <antirez@gmail.com> | 2018-05-29 12:37:39 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2018-05-29 12:37:42 +0200 |
commit | 49147f36e942b3367a3d1c3f7f83582fcbc06006 (patch) | |
tree | 13152c5e4bfbc09dfbe6d77c8ace5684f41982fd /src/aof.c | |
parent | 2a887bd53f992b940c7c9838a5dbdc2de1e3720a (diff) | |
download | redis-49147f36e942b3367a3d1c3f7f83582fcbc06006.tar.gz |
Don't expire keys while loading RDB from AOF preamble.
The AOF tail of a combined RDB+AOF is based on the premise of applying
the AOF commands to the exact state that there was in the server while
the RDB was persisted. By expiring keys while loading the RDB file, we
change the state, so applying the AOF tail later may change the state.
Test case:
* Time1: SET a 10
* Time2: EXPIREAT a $time5
* Time3: INCR a
* Time4: PERSIT A. Start bgrewiteaof with RDB preamble. The value of a is 11 without expire time.
* Time5: Restart redis from the RDB+AOF: consistency violation.
Thanks to @soloestoy for providing the patch.
Thanks to @trevor211 for the original issue report and the initial fix.
Check issue #4950 for more info.
Diffstat (limited to 'src/aof.c')
-rw-r--r-- | src/aof.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -713,7 +713,7 @@ int loadAppendOnlyFile(char *filename) { serverLog(LL_NOTICE,"Reading RDB preamble from AOF file..."); if (fseek(fp,0,SEEK_SET) == -1) goto readerr; rioInitWithFile(&rdb,fp); - if (rdbLoadRio(&rdb,NULL) != C_OK) { + if (rdbLoadRio(&rdb,NULL,1) != C_OK) { serverLog(LL_WARNING,"Error reading the RDB preamble of the AOF file, AOF loading aborted"); goto readerr; } else { |