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
824ea017
Commit
824ea017
authored
Jan 30, 2012
by
Salvatore Sanfilippo
Browse files
Merge pull request #321 from mkwiatkowski/ticket227
SORT with STORE removes key if result is empty. This fixes issue #227.
parents
6c294101
a0bf8d0a
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/sort.c
View file @
824ea017
...
...
@@ -367,9 +367,14 @@ void sortCommand(redisClient *c) {
}
}
}
if
(
outputlen
)
setKey
(
c
->
db
,
storekey
,
sobj
);
if
(
outputlen
)
{
setKey
(
c
->
db
,
storekey
,
sobj
);
server
.
dirty
+=
outputlen
;
}
else
if
(
dbDelete
(
c
->
db
,
storekey
))
{
signalModifiedKey
(
c
->
db
,
storekey
);
server
.
dirty
++
;
}
decrRefCount
(
sobj
);
server
.
dirty
+=
outputlen
;
addReplyLongLong
(
c
,
outputlen
);
}
...
...
tests/unit/cas.tcl
View file @
824ea017
...
...
@@ -25,6 +25,16 @@ start_server {tags {"cas"}} {
r exec
}
{}
test
{
EXEC fail on WATCHed key modified by SORT with STORE even if the result is empty
}
{
r flushdb
r lpush foo bar
r watch foo
r sort emptylist store foo
r multi
r ping
r exec
}
{}
test
{
After successful EXEC key is no longer watched
}
{
r set x 30
r watch x
...
...
tests/unit/sort.tcl
View file @
824ea017
...
...
@@ -150,6 +150,13 @@ start_server {
r exists zap
}
{
0
}
test
"SORT with STORE removes key if result is empty (github issue 227)"
{
r flushdb
r lpush foo bar
r sort emptylist store foo
r exists foo
}
{
0
}
tags
{
"slow"
}
{
set num 100
set res
[
create_random_dataset $num lpush
]
...
...
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