]> git.saurik.com Git - redis.git/commitdiff
fixed a bug in bgsave when VM is off but still it was testing for obj->storage field
authorantirez <antirez@gmail.com>
Wed, 6 Jan 2010 00:51:30 +0000 (19:51 -0500)
committerantirez <antirez@gmail.com>
Wed, 6 Jan 2010 00:51:30 +0000 (19:51 -0500)
redis.c

diff --git a/redis.c b/redis.c
index e427ab603bf3abf7173b7b09ca6db341a4b4e806..56b5895dfc915abf8bf179ec609300b72c88cd4f 100644 (file)
--- a/redis.c
+++ b/redis.c
@@ -2888,7 +2888,7 @@ static int rdbSave(char *filename) {
             }
             /* Save the key and associated value. This requires special
              * handling if the value is swapped out. */
-            if (key->storage == REDIS_VM_MEMORY) {
+            if (!server.vm_enabled || key->storage == REDIS_VM_MEMORY) {
                 /* Save type, key, value */
                 if (rdbSaveType(fp,o->type) == -1) goto werr;
                 if (rdbSaveStringObject(fp,key) == -1) goto werr;
@@ -6532,7 +6532,7 @@ static int rewriteAppendOnlyFile(char *filename) {
             int swapped;
 
             key = dictGetEntryKey(de);
-            if (key->storage == REDIS_VM_MEMORY) {
+            if (!server.vm_enabled || key->storage == REDIS_VM_MEMORY) {
                 o = dictGetEntryVal(de);
                 swapped = 0;
             } else {
@@ -6889,7 +6889,7 @@ static int vmSwapObject(robj *key, robj *val) {
 static robj *vmGenericLoadObject(robj *key, int preview) {
     robj *val;
 
-    assert(key->storage == REDIS_VM_SWAPPED);
+    redisAssert(key->storage == REDIS_VM_SWAPPED);
     if (fseeko(server.vm_fp,key->vm.page*server.vm_page_size,SEEK_SET) == -1) {
         redisLog(REDIS_WARNING,
             "Unrecoverable VM problem in vmLoadObject(): can't seek: %s",