summaryrefslogtreecommitdiff
path: root/src/rdb.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2020-04-09 11:09:40 +0200
committerantirez <antirez@gmail.com>2020-04-09 11:09:40 +0200
commit3d5b2d41b52906269778c42fec40d3c85535b9bf (patch)
treedd39abaf96a0318076ee91c7e5fcb41c2bd6c847 /src/rdb.c
parent30adc62232b2f8fe7dc31b850d8df3979f443234 (diff)
downloadredis-3d5b2d41b52906269778c42fec40d3c85535b9bf.tar.gz
RDB: clarify a condition in rdbLoadRio().
Diffstat (limited to 'src/rdb.c')
-rw-r--r--src/rdb.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/rdb.c b/src/rdb.c
index d3104ffbf..313830c25 100644
--- a/src/rdb.c
+++ b/src/rdb.c
@@ -2231,8 +2231,14 @@ int rdbLoadRio(rio *rdb, int rdbflags, rdbSaveInfo *rsi) {
* an RDB file from disk, either at startup, or when an RDB was
* received from the master. In the latter case, the master is
* responsible for key expiry. If we would expire keys here, the
- * snapshot taken by the master may not be reflected on the slave. */
- if (iAmMaster() && !(rdbflags&RDBFLAGS_AOF_PREAMBLE) && expiretime != -1 && expiretime < now) {
+ * snapshot taken by the master may not be reflected on the slave.
+ * Similarly if the RDB is the preamble of an AOF file, we want to
+ * load all the keys as they are, since the log of operations later
+ * assume to work in an exact keyspace state. */
+ if (iAmMaster() &&
+ !(rdbflags&RDBFLAGS_AOF_PREAMBLE) &&
+ expiretime != -1 && expiretime < now)
+ {
sdsfree(key);
decrRefCount(val);
} else {