Zadd command passing empty array

296 views
Skip to first unread message

ren...@rivancic.com

unread,
Jul 6, 2018, 5:35:41 AM7/6/18
to lettuce-redis-client-users
In my application I am using sorted set with lettuce to store data.
I also have a case the data is filtered before writing it into Redis. I was not expecting to see lettuce driver fail trying to insert empty array. I assumed it will not assert anything but not throwing an exception.

java.lang.IllegalArgumentException: ScoresAndValues must not be empty
    at io
.lettuce.core.internal.LettuceAssert.notEmpty(LettuceAssert.java:71)
    at io
.lettuce.core.RedisCommandBuilder.zadd(RedisCommandBuilder.java:2317)

I also did not find an example inside test suite. https://github.com/lettuce-io/lettuce-core/blob/master/src/test/java/io/lettuce/core/commands/SortedSetCommandTest.java

Should I create a task for it?

Mark Paluch

unread,
Jul 7, 2018, 3:48:53 AM7/7/18
to lettuce-redis-client-users
Hi, 

Lettuce validates for arguments with rules that are similar to what Redis does. ZADD without a single score and value translates in Redis to 

ERR wrong number of arguments for 'zadd' command

Lettuce prevents known error cases with its own validation to prevent a network roundtrip. A lenient drop of the command isn't the right thing to do.

Cheers, 
Mark
Reply all
Reply to author
Forward
0 new messages