}
}
}
- 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);
}
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
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]