Merge pull request #296 from pietern/2.4-expirefix

Don't expire keys when loading an RDB after a SYNC
This commit is contained in:
Salvatore Sanfilippo 2012-01-16 01:18:41 -08:00
commit 58bfbd1fa4

View File

@ -993,8 +993,12 @@ int rdbLoad(char *filename) {
if ((key = rdbLoadStringObject(fp)) == NULL) goto eoferr;
/* Read value */
if ((val = rdbLoadObject(type,fp)) == 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;