Commit e8de5c7a authored by antirez's avatar antirez
Browse files

Fix for VM swapping out at DB loading time when key is shared

parent 61e4ff2f
......@@ -4132,9 +4132,17 @@ static int rdbLoad(char *filename) {
key = dictGetEntryKey(de);
val = dictGetEntryVal(de);
if (vmSwapObjectBlocking(key,val) == REDIS_OK) {
dictGetEntryVal(de) = NULL;
if (val->refcount != 1) continue;
/* Unshare the key if needed */
if (key->refcount != 1) {
robj *newkey = dupStringObject(key);
decrRefCount(key);
key = dictGetEntryKey(de) = newkey;
}
if (vmSwapObjectBlocking(key,val) == REDIS_OK)
dictGetEntryVal(de) = NULL;
}
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