Description
In org.springframework.data:spring-data-redis:2.4.5
, in org.springframework.data.redis.connection.jedis.JedisKeyCommands#scan(long, org.springframework.data.redis.core.ScanOptions)
[1] we round trip keys through String
, corrupting them. This makes it impossible scan top level keys using Jedis.
Specifically, we call redis.clients.jedis.Jedis#scan(java.lang.String, redis.clients.jedis.ScanParams)
which decodes keys as strings, interpreting the binary data as UTF-8. On the next line, we encode the strings back into byte arrays using JedisConverters.stringListToByteList()
, which renders UTF-8 again. This generally results in any non-UTF-8 sequences in a binary key being replaced with efbfbd
(the UTF-8 serialization of the Unicode replacement character).
Instead, we should call redis.clients.jedis.BinaryJedis#scan(byte[], redis.clients.jedis.ScanParams)
and remove the second conversion using JedisConverters.stringListToByteList()
.