Skip to content

RedisTemplate.hasKey() Behavior Change with setEnableTransactionSupport = true #2886

Closed
@leeyohan93

Description

@leeyohan93

When setEnableTransactionSupport is set to true in RedisTemplate,
the behavior of RedisTemplate.hasKey() may differ depending on the version of Spring Data Redis:

  • In version 2.7.X: hasKey() responds with a valid value.
  • In version 3.0.X ~ 3.2.X: hasKey() responds with null.

Based on the code debug, it appears that the introduction of RedisTemplate.doWithKeys() may have led to a change in the behavior of ConnectionSplittingInterceptor.intercept() In version 2.7, the invoke method at line 487 is called, while in version 3.0, the invoke method at line 477 is called.

In recent Spring Data Redis documentation, it is mentioned that "Read-only commands" are designed to work well in transactional contexts. However, it's unclear whether the exclusion of the hasKey command from this behavior is intentional or a bug.

I am using spring data redis well. Thank you

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions