Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit e8de5c7a3fa2d0952293a12326719950a6f5535a 1 parent 61e4ff2
@antirez authored
Showing with 10 additions and 2 deletions.
  1. +10 −2 redis.c
View
12 redis.c
@@ -4131,10 +4131,18 @@ static int rdbLoad(char *filename) {
if (de) {
key = dictGetEntryKey(de);
val = dictGetEntryVal(de);
+
+ 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) {
+ if (vmSwapObjectBlocking(key,val) == REDIS_OK)
dictGetEntryVal(de) = NULL;
- }
}
continue;
}
Please sign in to comment.
Something went wrong with that request. Please try again.