Skip to content
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

Use unsigned type for cursors #570

Merged
merged 1 commit into from
Jun 17, 2024
Merged

Conversation

tyler92
Copy link
Contributor

@tyler92 tyler92 commented Jun 7, 2024

We faced the issue when the SCAN command returned too big value for long long type which led to the error Invalid cursor reply: 9286422431637963776. This happened with AWS ElastiCache (Redis). According to the documentation:

SCAN, SSCAN, HSCAN and ZSCAN return a two element multi-bulk reply, where the first element is a string representing an unsigned 64 bit number (the cursor), and the second element is a multi-bulk with an array of elements.

Also, the same issue was fixed for Spring: spring-projects/spring-data-redis#2796

I realize this change is quite big and probably a braking change, but I believe we need to fix it. So I replaced all long long cursors with Cursor alias which is unsigned long long. Probably it's better to use std::uint64_t to be more precise.

@sewenew
Copy link
Owner

sewenew commented Jun 13, 2024

Thanks for reporting this problem! I'll take a review on it ASAP.

Sorry for the late reply, too busy these days.

Regards

@sewenew sewenew merged commit add50aa into sewenew:master Jun 17, 2024
2 checks passed
@sewenew
Copy link
Owner

sewenew commented Jun 17, 2024

Thanks again for your contribution!

I moved the Cursor definition to sw/redis++/utils. So that C++ 11 build can also use it.

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants