#define REDIS_SHARED_INTEGERS 10000
struct sharedObjectsStruct {
- robj *crlf, *ok, *err, *emptybulk, *czero, *cone, *pong, *space,
+ robj *crlf, *ok, *err, *emptybulk, *czero, *cone, *cnegone, *pong, *space,
*colon, *nullbulk, *nullmultibulk, *queued,
*emptymultibulk, *wrongtypeerr, *nokeyerr, *syntaxerr, *sameobjecterr,
*outofrangeerr, *plus,
shared.emptybulk = createObject(REDIS_STRING,sdsnew("$0\r\n\r\n"));
shared.czero = createObject(REDIS_STRING,sdsnew(":0\r\n"));
shared.cone = createObject(REDIS_STRING,sdsnew(":1\r\n"));
+ shared.cnegone = createObject(REDIS_STRING,sdsnew(":-1\r\n"));
shared.nullbulk = createObject(REDIS_STRING,sdsnew("$-1\r\n"));
shared.nullmultibulk = createObject(REDIS_STRING,sdsnew("*-1\r\n"));
shared.emptymultibulk = createObject(REDIS_STRING,sdsnew("*0\r\n"));
ziplistLen(subject->ptr) > server.list_max_ziplist_entries)
listTypeConvert(subject,REDIS_ENCODING_LIST);
server.dirty++;
+ } else {
+ /* Notify client of a failed insert */
+ addReply(c,shared.cnegone);
+ return;
}
} else {
listTypePush(subject,val,where);
assert_equal 6 [r linsert xlist after c yy]
assert_equal {a b zz c yy d} [r lrange xlist 0 10]
assert_equal 7 [r linsert xlist after d dd]
- assert_equal 7 [r linsert xlist after bad ddd]
+ assert_equal -1 [r linsert xlist after bad ddd]
assert_equal {a b zz c yy d dd} [r lrange xlist 0 10]
assert_equal 8 [r linsert xlist before a aa]
- assert_equal 8 [r linsert xlist before bad aaa]
+ assert_equal -1 [r linsert xlist before bad aaa]
assert_equal {aa a b zz c yy d dd} [r lrange xlist 0 10]
# check inserting integer encoded value
# don't convert when the value could not be inserted
create_ziplist xlist [lrepeat 256 a]
- assert_equal 256 [r linsert xlist before foo a]
+ assert_equal -1 [r linsert xlist before foo a]
assert_encoding ziplist xlist
create_ziplist xlist [lrepeat 256 a]
- assert_equal 256 [r linsert xlist after foo a]
+ assert_equal -1 [r linsert xlist after foo a]
assert_encoding ziplist xlist
}