Commit 58bfbd1f authored by Salvatore Sanfilippo's avatar Salvatore Sanfilippo
Browse files

Merge pull request #296 from pietern/2.4-expirefix

Don't expire keys when loading an RDB after a SYNC
parents 8b8261ed aa794ac0
...@@ -993,8 +993,12 @@ int rdbLoad(char *filename) { ...@@ -993,8 +993,12 @@ int rdbLoad(char *filename) {
if ((key = rdbLoadStringObject(fp)) == NULL) goto eoferr; if ((key = rdbLoadStringObject(fp)) == NULL) goto eoferr;
/* Read value */ /* Read value */
if ((val = rdbLoadObject(type,fp)) == NULL) goto eoferr; if ((val = rdbLoadObject(type,fp)) == NULL) goto eoferr;
/* Check if the key already expired */ /* Check if the key already expired. This function is used when loading
if (expiretime != -1 && expiretime < now) { * 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(key);
decrRefCount(val); decrRefCount(val);
continue; continue;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment