mirror of
https://github.com/fluencelabs/redis
synced 2025-06-21 21:11:33 +00:00
Fix for VM swapping out at DB loading time when key is shared
This commit is contained in:
12
redis.c
12
redis.c
@ -4132,9 +4132,17 @@ static int rdbLoad(char *filename) {
|
|||||||
key = dictGetEntryKey(de);
|
key = dictGetEntryKey(de);
|
||||||
val = dictGetEntryVal(de);
|
val = dictGetEntryVal(de);
|
||||||
|
|
||||||
if (vmSwapObjectBlocking(key,val) == REDIS_OK) {
|
if (val->refcount != 1) continue;
|
||||||
dictGetEntryVal(de) = NULL;
|
|
||||||
|
/* 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;
|
continue;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user