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
63b29390
Commit
63b29390
authored
Mar 10, 2011
by
Pieter Noordhuis
Browse files
Convert encoding of result when in limits
parent
46aa0e24
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/t_zset.c
View file @
63b29390
...
...
@@ -1426,6 +1426,7 @@ void zunionInterGenericCommand(redisClient *c, robj *dstkey, int op) {
zsetopsrc
*
src
;
zsetopval
zval
;
robj
*
tmp
;
unsigned
int
maxelelen
=
0
;
robj
*
dstobj
;
zset
*
dstzset
;
zskiplistNode
*
znode
;
...
...
@@ -1539,6 +1540,10 @@ void zunionInterGenericCommand(redisClient *c, robj *dstkey, int op) {
incrRefCount
(
tmp
);
/* added to skiplist */
dictAdd
(
dstzset
->
dict
,
tmp
,
&
znode
->
score
);
incrRefCount
(
tmp
);
/* added to dictionary */
if
(
tmp
->
encoding
==
REDIS_ENCODING_RAW
)
if
(
sdslen
(
tmp
->
ptr
)
>
maxelelen
)
maxelelen
=
sdslen
(
tmp
->
ptr
);
}
}
}
...
...
@@ -1571,6 +1576,10 @@ void zunionInterGenericCommand(redisClient *c, robj *dstkey, int op) {
incrRefCount
(
zval
.
ele
);
/* added to skiplist */
dictAdd
(
dstzset
->
dict
,
tmp
,
&
znode
->
score
);
incrRefCount
(
zval
.
ele
);
/* added to dictionary */
if
(
tmp
->
encoding
==
REDIS_ENCODING_RAW
)
if
(
sdslen
(
tmp
->
ptr
)
>
maxelelen
)
maxelelen
=
sdslen
(
tmp
->
ptr
);
}
}
}
else
{
...
...
@@ -1586,13 +1595,18 @@ void zunionInterGenericCommand(redisClient *c, robj *dstkey, int op) {
server
.
dirty
++
;
}
if
(
dstzset
->
zsl
->
length
)
{
/* Convert to ziplist when in limits. */
if
(
dstzset
->
zsl
->
length
<=
server
.
zset_max_ziplist_entries
&&
maxelelen
<=
server
.
zset_max_ziplist_value
)
zsConvert
(
dstobj
,
REDIS_ENCODING_ZIPLIST
);
dbAdd
(
c
->
db
,
dstkey
,
dstobj
);
addReplyLongLong
(
c
,
dstzset
->
zsl
->
length
);
if
(
!
touched
)
touchWatch
edKey
(
c
->
db
,
dstkey
);
addReplyLongLong
(
c
,
zsLength
(
dstobj
)
);
if
(
!
touched
)
signalModifi
edKey
(
c
->
db
,
dstkey
);
server
.
dirty
++
;
}
else
{
decrRefCount
(
dstobj
);
addReply
(
c
,
shared
.
czero
);
addReply
(
c
,
shared
.
czero
);
}
zfree
(
src
);
}
...
...
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