-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redis SCAN
cursor exceeds Long.MAX_VALUE
resulting in NumberFormatException
#2796
Comments
Redis uses an unsigned 64 bit long value whereas our implementation uses the signed variant. We need to fix this bug. |
@mp911de I'm having a similar problem right now, and if the issue is before the revision, can I fix it and post PR? |
Unfortuneately, this change isn't straightforward as the cursor is being used across the |
SCAN
cursor exceeds Long.MAX_VALUE
resulting in NumberFormatException
Redis uses an unsigned 64bit value for its cursor id which is now captured via parseUnsignedLong. Closes: #2796
Redis uses an unsigned 64bit value for its cursor id which is now captured via parseUnsignedLong. Closes: #2796
- Spring Data 3.3 deprecated `long cursorId` in favor of String-backed `CursorId` object to avoid `NumberFormatException` when then cursor ID is bigger than max long - more info: spring-projects/spring-data-redis#2796
- Spring Data 3.3 deprecated `long cursorId` in favor of String-backed `CursorId` object to avoid `NumberFormatException` when then cursor ID is bigger than max long - more info: spring-projects/spring-data-redis#2796 Signed-off-by: Vlastimil Kotas <[email protected]>
Bug Report
Current Behavior
I am using AWS ElastiCache (Redis), the brand new serverless version of it (https://aws.amazon.com/blogs/aws/amazon-elasticache-serverless-for-redis-and-memcached-now-generally-available/). This is the first time I am using AWS ElastiCache at all, so I am not sure whether this is new Serverless ElasticCache specific or maybe ElastiCache related issue in general.
So, I connect to Redis using Lettuce:
and I create RedisTemplate like this
All good. I can write and read from Redis.
Then I try to do simple scan like that
Cursor c = redisTemplate.scan(ScanOptions.scanOptions().match(cacheName + "*").build());
And I get an exception
To get confirmation I connect to Redis via redis-cli and
Well, 9286422431637962824 returned by AWS Redis as the cursor is bigger than Long.MAX_VALUE and this is the source of the problem.
There is ScanIteration which expects cursorId to be long
and LettuceScanIteration extends ScanIteration
while io.lettuce.core.ScanCursor treats cursor as String.
Expected behavior/code
Scan should work and not end up in NumberFormatException.
Environment
Summary
Seems like there are 3 options on a table:
As I was not able to find specification about cursor value by Redis and due to the fact that in the end it is spring-data-redis codebase which does Long.parseLong(cursorValueFromRedis) line of code I decided to start by reporting bug first here.
Quick workaround
Could you please suggest a quick workaround if possible?
The text was updated successfully, but these errors were encountered: