Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
cbae1d34
Commit
cbae1d34
authored
May 20, 2010
by
antirez
Browse files
Fix for DEBUG DIGEST
parent
8513a757
Changes
2
Hide whitespace changes
Inline
Side-by-side
redis.c
View file @
cbae1d34
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
* POSSIBILITY OF SUCH DAMAGE.
* POSSIBILITY OF SUCH DAMAGE.
*/
*/
#define REDIS_VERSION "1.3.1
2
"
#define REDIS_VERSION "1.3.1
3
"
#include "fmacros.h"
#include "fmacros.h"
#include "config.h"
#include "config.h"
...
@@ -10432,18 +10432,23 @@ static void computeDatasetDigest(unsigned char *final) {
...
@@ -10432,18 +10432,23 @@ static void computeDatasetDigest(unsigned char *final) {
/* Iterate this DB writing every entry */
/* Iterate this DB writing every entry */
while((de = dictNext(di)) != NULL) {
while((de = dictNext(di)) != NULL) {
robj *key, *o;
robj *key, *o
, *kcopy
;
time_t expiretime;
time_t expiretime;
memset(digest,0,20); /* This key-val digest */
memset(digest,0,20); /* This key-val digest */
key = dictGetEntryKey(de);
key = dictGetEntryKey(de);
mixObjectDigest(digest,key);
if (!server.vm_enabled
|| key->storage == REDIS_VM_MEMORY ||
if (!server.vm_enabled
) {
key->storage == REDIS_VM_SWAPPING) {
mixObjectDigest(digest,key);
o = dictGetEntryVal(de);
o = dictGetEntryVal(de);
incrRefCount(o);
} else {
} 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);
aux = htonl(o->type);
mixDigest(digest,&aux,sizeof(aux));
mixDigest(digest,&aux,sizeof(aux));
...
@@ -10512,7 +10517,6 @@ static void computeDatasetDigest(unsigned char *final) {
...
@@ -10512,7 +10517,6 @@ static void computeDatasetDigest(unsigned char *final) {
} else {
} else {
redisPanic("Unknown object type");
redisPanic("Unknown object type");
}
}
decrRefCount(o);
/* If the key has an expire, add it to the mix */
/* If the key has an expire, add it to the mix */
if (expiretime != -1) xorDigest(digest,"!!expire!!",10);
if (expiretime != -1) xorDigest(digest,"!!expire!!",10);
/* We can finally xor the key-val digest to the final digest */
/* We can finally xor the key-val digest to the final digest */
...
...
staticsymbols.h
View file @
cbae1d34
...
@@ -180,6 +180,7 @@ static struct redisFunctionSym symsTable[] = {
...
@@ -180,6 +180,7 @@ static struct redisFunctionSym symsTable[] = {
{
"oom"
,(
unsigned
long
)
oom
},
{
"oom"
,(
unsigned
long
)
oom
},
{
"pingCommand"
,(
unsigned
long
)
pingCommand
},
{
"pingCommand"
,(
unsigned
long
)
pingCommand
},
{
"popGenericCommand"
,(
unsigned
long
)
popGenericCommand
},
{
"popGenericCommand"
,(
unsigned
long
)
popGenericCommand
},
{
"prepareForShutdown"
,(
unsigned
long
)
prepareForShutdown
},
{
"processCommand"
,(
unsigned
long
)
processCommand
},
{
"processCommand"
,(
unsigned
long
)
processCommand
},
{
"processInputBuffer"
,(
unsigned
long
)
processInputBuffer
},
{
"processInputBuffer"
,(
unsigned
long
)
processInputBuffer
},
{
"psubscribeCommand"
,(
unsigned
long
)
psubscribeCommand
},
{
"psubscribeCommand"
,(
unsigned
long
)
psubscribeCommand
},
...
@@ -260,6 +261,7 @@ static struct redisFunctionSym symsTable[] = {
...
@@ -260,6 +261,7 @@ static struct redisFunctionSym symsTable[] = {
{
"setnxCommand"
,(
unsigned
long
)
setnxCommand
},
{
"setnxCommand"
,(
unsigned
long
)
setnxCommand
},
{
"setupSigSegvAction"
,(
unsigned
long
)
setupSigSegvAction
},
{
"setupSigSegvAction"
,(
unsigned
long
)
setupSigSegvAction
},
{
"shutdownCommand"
,(
unsigned
long
)
shutdownCommand
},
{
"shutdownCommand"
,(
unsigned
long
)
shutdownCommand
},
{
"sigtermHandler"
,(
unsigned
long
)
sigtermHandler
},
{
"sinterCommand"
,(
unsigned
long
)
sinterCommand
},
{
"sinterCommand"
,(
unsigned
long
)
sinterCommand
},
{
"sinterGenericCommand"
,(
unsigned
long
)
sinterGenericCommand
},
{
"sinterGenericCommand"
,(
unsigned
long
)
sinterGenericCommand
},
{
"sinterstoreCommand"
,(
unsigned
long
)
sinterstoreCommand
},
{
"sinterstoreCommand"
,(
unsigned
long
)
sinterstoreCommand
},
...
@@ -272,6 +274,8 @@ static struct redisFunctionSym symsTable[] = {
...
@@ -272,6 +274,8 @@ static struct redisFunctionSym symsTable[] = {
{
"spopCommand"
,(
unsigned
long
)
spopCommand
},
{
"spopCommand"
,(
unsigned
long
)
spopCommand
},
{
"srandmemberCommand"
,(
unsigned
long
)
srandmemberCommand
},
{
"srandmemberCommand"
,(
unsigned
long
)
srandmemberCommand
},
{
"sremCommand"
,(
unsigned
long
)
sremCommand
},
{
"sremCommand"
,(
unsigned
long
)
sremCommand
},
{
"startAppendOnly"
,(
unsigned
long
)
startAppendOnly
},
{
"stopAppendOnly"
,(
unsigned
long
)
stopAppendOnly
},
{
"stringObjectLen"
,(
unsigned
long
)
stringObjectLen
},
{
"stringObjectLen"
,(
unsigned
long
)
stringObjectLen
},
{
"stringmatch"
,(
unsigned
long
)
stringmatch
},
{
"stringmatch"
,(
unsigned
long
)
stringmatch
},
{
"stringmatchlen"
,(
unsigned
long
)
stringmatchlen
},
{
"stringmatchlen"
,(
unsigned
long
)
stringmatchlen
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment