]> git.saurik.com Git - redis.git/commitdiff
Fix for DEBUG DIGEST
authorantirez <antirez@metal.(none)>
Thu, 20 May 2010 14:50:40 +0000 (16:50 +0200)
committerantirez <antirez@metal.(none)>
Thu, 20 May 2010 14:50:40 +0000 (16:50 +0200)
redis.c
staticsymbols.h

diff --git a/redis.c b/redis.c
index d6c6cbdf2636bb9b34fbd59ad3a5410b3a46a419..f2fbbdd53490303fd70e4fce47d8e36d94df1c89 100644 (file)
--- a/redis.c
+++ b/redis.c
@@ -27,7 +27,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#define REDIS_VERSION "1.3.12"
+#define REDIS_VERSION "1.3.13"
 
 #include "fmacros.h"
 #include "config.h"
@@ -10432,18 +10432,23 @@ static void computeDatasetDigest(unsigned char *final) {
 
         /* Iterate this DB writing every entry */
         while((de = dictNext(di)) != NULL) {
-            robj *key, *o;
+            robj *key, *o, *kcopy;
             time_t expiretime;
 
             memset(digest,0,20); /* This key-val digest */
             key = dictGetEntryKey(de);
-            mixObjectDigest(digest,key);
-            if (!server.vm_enabled || key->storage == REDIS_VM_MEMORY ||
-                key->storage == REDIS_VM_SWAPPING) {
+
+            if (!server.vm_enabled) {
+                mixObjectDigest(digest,key);
                 o = dictGetEntryVal(de);
-                incrRefCount(o);
             } else {
-                o = vmPreviewObject(key);
+                /* Don't work with the key directly as when VM is active
+                 * this is unsafe: TODO: fix decrRefCount to check if the
+                 * count really reached 0 to avoid this mess */
+                kcopy = dupStringObject(key);
+                mixObjectDigest(digest,kcopy);
+                o = lookupKeyRead(db,kcopy);
+                decrRefCount(kcopy);
             }
             aux = htonl(o->type);
             mixDigest(digest,&aux,sizeof(aux));
@@ -10512,7 +10517,6 @@ static void computeDatasetDigest(unsigned char *final) {
             } else {
                 redisPanic("Unknown object type");
             }
-            decrRefCount(o);
             /* If the key has an expire, add it to the mix */
             if (expiretime != -1) xorDigest(digest,"!!expire!!",10);
             /* We can finally xor the key-val digest to the final digest */
index 9f8481d55fe70acf4caac394316bc867465a2780..30c4d779abe3c94f6011089acee6bad71740e893 100644 (file)
@@ -180,6 +180,7 @@ static struct redisFunctionSym symsTable[] = {
 {"oom",(unsigned long)oom},
 {"pingCommand",(unsigned long)pingCommand},
 {"popGenericCommand",(unsigned long)popGenericCommand},
+{"prepareForShutdown",(unsigned long)prepareForShutdown},
 {"processCommand",(unsigned long)processCommand},
 {"processInputBuffer",(unsigned long)processInputBuffer},
 {"psubscribeCommand",(unsigned long)psubscribeCommand},
@@ -260,6 +261,7 @@ static struct redisFunctionSym symsTable[] = {
 {"setnxCommand",(unsigned long)setnxCommand},
 {"setupSigSegvAction",(unsigned long)setupSigSegvAction},
 {"shutdownCommand",(unsigned long)shutdownCommand},
+{"sigtermHandler",(unsigned long)sigtermHandler},
 {"sinterCommand",(unsigned long)sinterCommand},
 {"sinterGenericCommand",(unsigned long)sinterGenericCommand},
 {"sinterstoreCommand",(unsigned long)sinterstoreCommand},
@@ -272,6 +274,8 @@ static struct redisFunctionSym symsTable[] = {
 {"spopCommand",(unsigned long)spopCommand},
 {"srandmemberCommand",(unsigned long)srandmemberCommand},
 {"sremCommand",(unsigned long)sremCommand},
+{"startAppendOnly",(unsigned long)startAppendOnly},
+{"stopAppendOnly",(unsigned long)stopAppendOnly},
 {"stringObjectLen",(unsigned long)stringObjectLen},
 {"stringmatch",(unsigned long)stringmatch},
 {"stringmatchlen",(unsigned long)stringmatchlen},