Skip to content

Encapsulate Redis Scan CursorId #2802

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

Closed
wants to merge 8 commits into from
Closed

Encapsulate Redis Scan CursorId #2802

wants to merge 8 commits into from

Conversation

mp911de
Copy link
Member

@mp911de mp911de commented Dec 12, 2023

We now retain the raw cursor value without attempting to convert it into a long as Redis uses 64 bit unsigned integers exceeding Long.MAX_VALUE.

Closes #2796

@mp911de mp911de added the type: bug A general bug label Dec 12, 2023
@christophstrobl
Copy link
Member

I do like having a dedicated type to encapsulate the cursor id. However, I'm curious if we'd be able to leverage Long.parseUnsignedLong and Long.toUnsignedString here in order to fix the issue for service releases without having to change the API.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
mp911de and others added 3 commits January 31, 2024 10:12
We now retain the raw cursor value without attempting to convert it into a long as Redis uses 64 bit unsigned integers exceeding Long.MAX_VALUE.

Fix broken id parsing for unsigned long value

Update deprecation warnings and method visibility.
update jenkinsfile to test against redis 7.2

Switch test to stable config property.

Replace usage of DEBUG command.
@@ -14,6 +14,7 @@ docker.mongodb.7.0.version=7.0.2

# Supported versions of Redis
docker.redis.6.version=6.2.13
docker.redis.7.version=7.2.4
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind updating the property in Spring Data Build as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

created the task already spring-projects/spring-data-build#2212 waiting for final review.

Jenkinsfile Outdated
sh "PROFILE=none LONG_TESTS=true JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh"
}
}
}
Copy link
Member Author

@mp911de mp911de Jan 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something is off in indentation (tabs vs spaces).

Copy link
Member

@christophstrobl christophstrobl Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me have a look at that.

ci/test.sh Outdated
@@ -18,7 +18,7 @@ export JENKINS_USER=${JENKINS_USER_NAME}
export GRADLE_ENTERPRISE_ACCESS_KEY=${DEVELOCITY_ACCESS_KEY}

# Execute maven test
MAVEN_OPTS="-Duser.name=${JENKINS_USER} -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml clean test -P${PROFILE} -DrunLongTests=${LONG_TESTS:-false} -U -B
MAVEN_OPTS="-Duser.name=${JENKINS_USER} -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml clean test -P${PROFILE} -DrunLongTests=${LONG_TESTS:-false} -Dgradle.cache.local.enabled=false -Dgradle.cache.remote.enabled=false -U -B
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erichaagdev Can you provide guidance on how to not skip tests when running builds against different build stages where the only change is the Redis or JDK version?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR will cause all tests to re-run in builds with these Maven options since it disables the build cache.

Test results come from cache when all inputs to the surefire/failsafe goal match a previous invocation in the cache. These inputs include the JDK version and the runtime classpath. So, assuming you have Redis in the classpath, these tests should re-execute on these sorts of changes even with the cache enabled.

Have you seen different behavior than this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR will cause all tests to re-run in builds with these Maven options since it disables the build cache.

That is intended because we want to run integration tests against a different Redis version. Our Redis service is an externally managed service that does not affect the classpath. We would need to have to tell the caching inputs about a changed cache key somehow.

Copy link

@clayburn clayburn Feb 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Essentially, you want to represent the version of Redis as an input to the surefire/failsafe goals. The documentation for that can be found here.

More specifically, you could either:

  • Pass in the Redis version as a system property to <argLine>
  • Specify some file in the Redis installation that represents the version as an input file

Either of these would invalidate the cache when the Redis version changes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the detail. <argLine> seems the most promising approach for now.

@christophstrobl christophstrobl added type: enhancement A general enhancement and removed type: bug A general bug labels Feb 1, 2024
Copy link
Member Author

@mp911de mp911de left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI changes look good.

@christophstrobl christophstrobl added this to the 3.3 M1 (2024.0.0) milestone Feb 7, 2024
christophstrobl added a commit that referenced this pull request Feb 8, 2024
Update jenkinsfile to test against redis 7.2
Replace usage of DEBUG command.
Provide Redis server version and client lib version to maven build system / gradle cache.

Original Pull Request: #2802
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redis SCAN cursor exceeds Long.MAX_VALUE resulting in NumberFormatException
3 participants