X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/d334281c802bc94e99475557ed341d356af0ab54..57be47758e3203fe5e01c15895c4351206415024:/src/rdb.c diff --git a/src/rdb.c b/src/rdb.c index 77e2a048..3a10e0ce 100644 --- a/src/rdb.c +++ b/src/rdb.c @@ -1026,8 +1026,12 @@ int rdbLoad(char *filename) { if ((key = rdbLoadStringObject(&rdb)) == NULL) goto eoferr; /* Read value */ if ((val = rdbLoadObject(type,&rdb)) == NULL) goto eoferr; - /* Check if the key already expired */ - if (expiretime != -1 && expiretime < now) { + /* Check if the key already expired. This function is used when loading + * 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 (server.masterhost == NULL && expiretime != -1 && expiretime < now) { decrRefCount(key); decrRefCount(val); continue;