Skip to content

Lettuce cluster refresh properties are ignored when the cluster is not configured using spring.data.redis.cluster properties - #52190

Merged
snicoll merged 1 commit into
spring-projects:4.0.xfrom
CCCLL:fix/lettuce-cluster-client-options
Oct 21, 2026
Merged

snicoll merged 1 commit into
spring-projects:4.0.xfrom
CCCLL:fix/lettuce-cluster-client-options

Conversation

@CCCLL

@CCCLL CCCLL commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

LettuceConnectionConfiguration decides whether to create ClusterClientOptions by checking whether any spring.data.redis.cluster.* property has been set. When the cluster is configured in another way, using a DataRedisConnectionDetails bean that returns a Cluster or a RedisClusterConfiguration bean, plain ClientOptions are created instead. As a result, the spring.data.redis.lettuce.cluster.refresh.* properties are silently ignored and a LettuceClientOptionsBuilderCustomizer is not given a ClusterClientOptions.Builder.

Use the mode that DataRedisConnectionConfiguration has already determined instead. It is also what selects the cluster connection factory.

Validation:

  • The two new tests fail before the fix (expected: io.lettuce.core.cluster.ClusterClientOptions but was: io.lettuce.core.ClientOptions) and pass afterwards.
  • :module:spring-boot-data-redis:check passed. The 125 tests in test passed; 10 of the 12 dockerTest tests were skipped as Docker was not available.
  • Checked against a local three-node Redis 8.6.2 cluster, with the node supplied by a DataRedisConnectionDetails bean and spring.data.redis.lettuce.cluster.refresh.period=1s. Before the fix, periodic refresh was disabled on the RedisClusterClient and the number of CLUSTER NODES calls received by a node did not change over six seconds. After the fix, it was enabled and the count rose from 7 to 13.

Tested on 4.0.x (2ad144241ad) with JDK 25.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue that has not yet been triaged. Contributions will not be accepted. label Oct 13, 2026
@snicoll snicoll added type: bug A general bug and removed status: waiting-for-triage An issue that has not yet been triaged. Contributions will not be accepted. labels Oct 14, 2026
@snicoll snicoll added this to the 4.0.x milestone Oct 14, 2026
Previously, ClusterClientOptions were only created, and the
spring.data.redis.lettuce.cluster.refresh.* properties only applied,
when spring.data.redis.cluster.* properties were set. When the cluster
was configured using a DataRedisConnectionDetails bean or a
RedisClusterConfiguration bean, plain ClientOptions were created and
the refresh properties were ignored.

Use the mode that has already been determined for the connection
rather than checking the cluster properties.

See spring-projectsgh-52190

Signed-off-by: Jialin Chen <cccll2019@gmail.com>
@snicoll
snicoll force-pushed the fix/lettuce-cluster-client-options branch from c233c5a to a0a090e Compare October 21, 2026 08:00
@snicoll snicoll self-assigned this Oct 21, 2026
@snicoll snicoll modified the milestones: 4.0.x, 4.0.10 Oct 21, 2026
@snicoll
snicoll merged commit ac1b357 into spring-projects:4.0.x Oct 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug A general bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants