Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
ad6de43c
Commit
ad6de43c
authored
Mar 18, 2010
by
antirez
Browse files
zipmap fix for large values
parent
db5946fc
Changes
4
Hide whitespace changes
Inline
Side-by-side
staticsymbols.h
View file @
ad6de43c
...
@@ -3,10 +3,12 @@ static struct redisFunctionSym symsTable[] = {
...
@@ -3,10 +3,12 @@ static struct redisFunctionSym symsTable[] = {
{
"_redisAssert"
,(
unsigned
long
)
_redisAssert
},
{
"_redisAssert"
,(
unsigned
long
)
_redisAssert
},
{
"acceptHandler"
,(
unsigned
long
)
acceptHandler
},
{
"acceptHandler"
,(
unsigned
long
)
acceptHandler
},
{
"addReply"
,(
unsigned
long
)
addReply
},
{
"addReply"
,(
unsigned
long
)
addReply
},
{
"addReplyBulk"
,(
unsigned
long
)
addReplyBulk
},
{
"addReplyBulkLen"
,(
unsigned
long
)
addReplyBulkLen
},
{
"addReplyBulkLen"
,(
unsigned
long
)
addReplyBulkLen
},
{
"addReplyDouble"
,(
unsigned
long
)
addReplyDouble
},
{
"addReplyDouble"
,(
unsigned
long
)
addReplyDouble
},
{
"addReplyLong"
,(
unsigned
long
)
addReplyLong
},
{
"addReplyLong"
,(
unsigned
long
)
addReplyLong
},
{
"addReplySds"
,(
unsigned
long
)
addReplySds
},
{
"addReplySds"
,(
unsigned
long
)
addReplySds
},
{
"addReplyUlong"
,(
unsigned
long
)
addReplyUlong
},
{
"aofRemoveTempFile"
,(
unsigned
long
)
aofRemoveTempFile
},
{
"aofRemoveTempFile"
,(
unsigned
long
)
aofRemoveTempFile
},
{
"appendCommand"
,(
unsigned
long
)
appendCommand
},
{
"appendCommand"
,(
unsigned
long
)
appendCommand
},
{
"appendServerSaveParams"
,(
unsigned
long
)
appendServerSaveParams
},
{
"appendServerSaveParams"
,(
unsigned
long
)
appendServerSaveParams
},
...
@@ -21,6 +23,7 @@ static struct redisFunctionSym symsTable[] = {
...
@@ -21,6 +23,7 @@ static struct redisFunctionSym symsTable[] = {
{
"brpopCommand"
,(
unsigned
long
)
brpopCommand
},
{
"brpopCommand"
,(
unsigned
long
)
brpopCommand
},
{
"bytesToHuman"
,(
unsigned
long
)
bytesToHuman
},
{
"bytesToHuman"
,(
unsigned
long
)
bytesToHuman
},
{
"call"
,(
unsigned
long
)
call
},
{
"call"
,(
unsigned
long
)
call
},
{
"checkType"
,(
unsigned
long
)
checkType
},
{
"closeTimedoutClients"
,(
unsigned
long
)
closeTimedoutClients
},
{
"closeTimedoutClients"
,(
unsigned
long
)
closeTimedoutClients
},
{
"compareStringObjects"
,(
unsigned
long
)
compareStringObjects
},
{
"compareStringObjects"
,(
unsigned
long
)
compareStringObjects
},
{
"computeObjectSwappability"
,(
unsigned
long
)
computeObjectSwappability
},
{
"computeObjectSwappability"
,(
unsigned
long
)
computeObjectSwappability
},
...
@@ -81,6 +84,7 @@ static struct redisFunctionSym symsTable[] = {
...
@@ -81,6 +84,7 @@ static struct redisFunctionSym symsTable[] = {
{
"fwriteBulkObject"
,(
unsigned
long
)
fwriteBulkObject
},
{
"fwriteBulkObject"
,(
unsigned
long
)
fwriteBulkObject
},
{
"fwriteBulkString"
,(
unsigned
long
)
fwriteBulkString
},
{
"fwriteBulkString"
,(
unsigned
long
)
fwriteBulkString
},
{
"genRedisInfoString"
,(
unsigned
long
)
genRedisInfoString
},
{
"genRedisInfoString"
,(
unsigned
long
)
genRedisInfoString
},
{
"genericHgetallCommand"
,(
unsigned
long
)
genericHgetallCommand
},
{
"genericZrangebyscoreCommand"
,(
unsigned
long
)
genericZrangebyscoreCommand
},
{
"genericZrangebyscoreCommand"
,(
unsigned
long
)
genericZrangebyscoreCommand
},
{
"getCommand"
,(
unsigned
long
)
getCommand
},
{
"getCommand"
,(
unsigned
long
)
getCommand
},
{
"getDecodedObject"
,(
unsigned
long
)
getDecodedObject
},
{
"getDecodedObject"
,(
unsigned
long
)
getDecodedObject
},
...
@@ -91,9 +95,15 @@ static struct redisFunctionSym symsTable[] = {
...
@@ -91,9 +95,15 @@ static struct redisFunctionSym symsTable[] = {
{
"glueReplyBuffersIfNeeded"
,(
unsigned
long
)
glueReplyBuffersIfNeeded
},
{
"glueReplyBuffersIfNeeded"
,(
unsigned
long
)
glueReplyBuffersIfNeeded
},
{
"handleClientsBlockedOnSwappedKey"
,(
unsigned
long
)
handleClientsBlockedOnSwappedKey
},
{
"handleClientsBlockedOnSwappedKey"
,(
unsigned
long
)
handleClientsBlockedOnSwappedKey
},
{
"handleClientsWaitingListPush"
,(
unsigned
long
)
handleClientsWaitingListPush
},
{
"handleClientsWaitingListPush"
,(
unsigned
long
)
handleClientsWaitingListPush
},
{
"hdelCommand"
,(
unsigned
long
)
hdelCommand
},
{
"hexistsCommand"
,(
unsigned
long
)
hexistsCommand
},
{
"hgetCommand"
,(
unsigned
long
)
hgetCommand
},
{
"hgetCommand"
,(
unsigned
long
)
hgetCommand
},
{
"hgetallCommand"
,(
unsigned
long
)
hgetallCommand
},
{
"hkeysCommand"
,(
unsigned
long
)
hkeysCommand
},
{
"hlenCommand"
,(
unsigned
long
)
hlenCommand
},
{
"hsetCommand"
,(
unsigned
long
)
hsetCommand
},
{
"hsetCommand"
,(
unsigned
long
)
hsetCommand
},
{
"htNeedsResize"
,(
unsigned
long
)
htNeedsResize
},
{
"htNeedsResize"
,(
unsigned
long
)
htNeedsResize
},
{
"hvalsCommand"
,(
unsigned
long
)
hvalsCommand
},
{
"incrCommand"
,(
unsigned
long
)
incrCommand
},
{
"incrCommand"
,(
unsigned
long
)
incrCommand
},
{
"incrDecrCommand"
,(
unsigned
long
)
incrDecrCommand
},
{
"incrDecrCommand"
,(
unsigned
long
)
incrDecrCommand
},
{
"incrRefCount"
,(
unsigned
long
)
incrRefCount
},
{
"incrRefCount"
,(
unsigned
long
)
incrRefCount
},
...
@@ -112,7 +122,9 @@ static struct redisFunctionSym symsTable[] = {
...
@@ -112,7 +122,9 @@ static struct redisFunctionSym symsTable[] = {
{
"lookupKey"
,(
unsigned
long
)
lookupKey
},
{
"lookupKey"
,(
unsigned
long
)
lookupKey
},
{
"lookupKeyByPattern"
,(
unsigned
long
)
lookupKeyByPattern
},
{
"lookupKeyByPattern"
,(
unsigned
long
)
lookupKeyByPattern
},
{
"lookupKeyRead"
,(
unsigned
long
)
lookupKeyRead
},
{
"lookupKeyRead"
,(
unsigned
long
)
lookupKeyRead
},
{
"lookupKeyReadOrReply"
,(
unsigned
long
)
lookupKeyReadOrReply
},
{
"lookupKeyWrite"
,(
unsigned
long
)
lookupKeyWrite
},
{
"lookupKeyWrite"
,(
unsigned
long
)
lookupKeyWrite
},
{
"lookupKeyWriteOrReply"
,(
unsigned
long
)
lookupKeyWriteOrReply
},
{
"lpopCommand"
,(
unsigned
long
)
lpopCommand
},
{
"lpopCommand"
,(
unsigned
long
)
lpopCommand
},
{
"lpushCommand"
,(
unsigned
long
)
lpushCommand
},
{
"lpushCommand"
,(
unsigned
long
)
lpushCommand
},
{
"lrangeCommand"
,(
unsigned
long
)
lrangeCommand
},
{
"lrangeCommand"
,(
unsigned
long
)
lrangeCommand
},
...
@@ -274,6 +286,7 @@ static struct redisFunctionSym symsTable[] = {
...
@@ -274,6 +286,7 @@ static struct redisFunctionSym symsTable[] = {
{
"zslInsert"
,(
unsigned
long
)
zslInsert
},
{
"zslInsert"
,(
unsigned
long
)
zslInsert
},
{
"zslRandomLevel"
,(
unsigned
long
)
zslRandomLevel
},
{
"zslRandomLevel"
,(
unsigned
long
)
zslRandomLevel
},
{
"zunionCommand"
,(
unsigned
long
)
zunionCommand
},
{
"zunionCommand"
,(
unsigned
long
)
zunionCommand
},
{
"zunionInterBlockClientOnSwappedKeys"
,(
unsigned
long
)
zunionInterBlockClientOnSwappedKeys
},
{
"zunionInterGenericCommand"
,(
unsigned
long
)
zunionInterGenericCommand
},
{
"zunionInterGenericCommand"
,(
unsigned
long
)
zunionInterGenericCommand
},
{
NULL
,
0
}
{
NULL
,
0
}
};
};
test-redis.tcl
View file @
ad6de43c
...
@@ -152,6 +152,7 @@ proc createComplexDataset {r ops} {
...
@@ -152,6 +152,7 @@ proc createComplexDataset {r ops} {
}
{
}
{
$r zadd $k $d $v
$r zadd $k $d $v
}
{
}
{
puts
"hset
$k
$f
$v
"
$r hset $k $f $v
$r hset $k $f $v
}
}
set t
[
$r
type $k
]
set t
[
$r
type $k
]
...
@@ -178,7 +179,7 @@ proc createComplexDataset {r ops} {
...
@@ -178,7 +179,7 @@ proc createComplexDataset {r ops} {
}
}
{
hash
}
{
{
hash
}
{
randpath
{
$r
hset $k $f $v
}
\
randpath
{
$r
hset $k $f $v
}
\
{
$r
hdel $k $f
}
{
puts
"
$r
hdel
$k
$f
"
;
$r hdel $k $f
}
}
}
}
}
}
}
...
...
zipmap.c
View file @
ad6de43c
...
@@ -116,7 +116,7 @@ static unsigned int zipmapDecodeLength(unsigned char *p) {
...
@@ -116,7 +116,7 @@ static unsigned int zipmapDecodeLength(unsigned char *p) {
unsigned
int
len
=
*
p
;
unsigned
int
len
=
*
p
;
if
(
len
<
ZIPMAP_BIGLEN
)
return
len
;
if
(
len
<
ZIPMAP_BIGLEN
)
return
len
;
memcpy
(
&
len
,
p
,
sizeof
(
unsigned
int
));
memcpy
(
&
len
,
p
+
1
,
sizeof
(
unsigned
int
));
return
len
;
return
len
;
}
}
...
...
zipmap.h
View file @
ad6de43c
...
@@ -43,5 +43,6 @@ unsigned char *zipmapNext(unsigned char *zm, unsigned char **key, unsigned int *
...
@@ -43,5 +43,6 @@ unsigned char *zipmapNext(unsigned char *zm, unsigned char **key, unsigned int *
int
zipmapGet
(
unsigned
char
*
zm
,
unsigned
char
*
key
,
unsigned
int
klen
,
unsigned
char
**
value
,
unsigned
int
*
vlen
);
int
zipmapGet
(
unsigned
char
*
zm
,
unsigned
char
*
key
,
unsigned
int
klen
,
unsigned
char
**
value
,
unsigned
int
*
vlen
);
int
zipmapExists
(
unsigned
char
*
zm
,
unsigned
char
*
key
,
unsigned
int
klen
);
int
zipmapExists
(
unsigned
char
*
zm
,
unsigned
char
*
key
,
unsigned
int
klen
);
unsigned
int
zipmapLen
(
unsigned
char
*
zm
);
unsigned
int
zipmapLen
(
unsigned
char
*
zm
);
void
zipmapRepr
(
unsigned
char
*
p
);
#endif
#endif
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