Skip to content

Conversation

LeeHyungGeol
Copy link
Contributor

Fix. #3187

Summary

Add missing RedisCommand enum entries for ZSet WithScores methods.

The rangeWithScores family of methods (zRangeWithScores, zRangeByScoreWithScores, zRevRangeWithScores, zRevRangeByScoreWithScores) were missing from the RedisCommand enumeration, causing ConnectionSplittingInterceptor to resolve them as UNKNOWN commands.

This resulted in read-only methods being incorrectly queued in MULTI/EXEC blocks instead of executing immediately on separate connections, causing them to return null in transactional contexts.

Changes:

  • Add ZRANGEWITHSCORES, ZRANGEBYSCOREWITHSCORES, ZREVRANGEWITHSCORES, ZREVRANGEBYSCOREWITHSCORES enum entries in RedisCommand.java
  • Add regression test in TransactionalStringRedisTemplateTests.java

The fix ensures these read-only methods are properly recognized and execute
immediately in transactional contexts.

  • You have read the Spring Data contribution guidelines.
  • You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.
  • You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 27, 2025
@LeeHyungGeol LeeHyungGeol force-pushed the fix/rangeWithScores-unknown-command-in-transaction branch from 8db154f to 7022c14 Compare September 27, 2025 10:42
…ANGEWITHSCORES, ZRANGEBYSCOREWITHSCORES, ZREVRANGEWITHSCORES, ZREVRANGEBYSCOREWITHSCORES

Signed-off-by: LeeHyungGeol <rjf1138@naver.com>
…dd author tags in the class header

Signed-off-by: LeeHyungGeol <rjf1138@naver.com>
…methods

Signed-off-by: LeeHyungGeol <rjf1138@naver.com>
@mp911de mp911de added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 29, 2025
onobc pushed a commit that referenced this pull request Sep 30, 2025
The rangeWithScores family of methods (zRangeWithScores, zRangeByScoreWithScores, zRevRangeWithScores, zRevRangeByScoreWithScores) were missing from the RedisCommand enumeration, causing ConnectionSplittingInterceptor to resolve them as UNKNOWN commands.

This resulted in read-only methods being incorrectly queued in MULTI/EXEC blocks instead of executing immediately on separate connections, causing them to return null in transactional contexts.

This commit adds the ZRANGEWITHSCORES, ZRANGEBYSCOREWITHSCORES, ZREVRANGEWITHSCORES, ZREVRANGEBYSCOREWITHSCORES enum entries to RedisCommand.java as well as adds a regression test in TransactionalStringRedisTemplateTests.java.

The fix ensures these read-only methods are properly recognized and execute immediately in transactional contexts.

Original Pull Request: #3225
Fixes: #3187

Signed-off-by: LeeHyungGeol <rjf1138@naver.com>
@onobc
Copy link
Contributor

onobc commented Sep 30, 2025

Thank you @LeeHyungGeol for the excellent contribution! I added a tiny polish commit to refactor out the verification method in the regression test (here).

Closing in favor of 96f250d

@onobc onobc closed this Sep 30, 2025
@onobc onobc linked an issue Sep 30, 2025 that may be closed by this pull request
@onobc onobc added this to the 3.4.11 (2024.1.11) milestone Sep 30, 2025
onobc added a commit that referenced this pull request Sep 30, 2025
…hods"

Adds convenience method to verify results in the newly added regression test in the previous commit.

Also removes a few warnings in the regression test by suppressing 'rawtypes' and 'unchecked' usages.

Original Pull Request: #3225
Related tickets: #3187

Signed-off-by: onobc <chris.bono@gmail.com>
onobc added a commit that referenced this pull request Sep 30, 2025
The rangeWithScores family of methods (zRangeWithScores, zRangeByScoreWithScores, zRevRangeWithScores, zRevRangeByScoreWithScores) were missing from the RedisCommand enumeration, causing ConnectionSplittingInterceptor to resolve them as UNKNOWN commands.

This resulted in read-only methods being incorrectly queued in MULTI/EXEC blocks instead of executing immediately on separate connections, causing them to return null in transactional contexts.

This commit adds the ZRANGEWITHSCORES, ZRANGEBYSCOREWITHSCORES, ZREVRANGEWITHSCORES, ZREVRANGEBYSCOREWITHSCORES enum entries to RedisCommand.java.

The fix ensures these read-only methods are properly recognized and execute immediately in transactional contexts.

Original Pull Request: #3225
Fixes: #3187

Signed-off-by: LeeHyungGeol <rjf1138@naver.com>

(cherry picked from commit 96f250d)

Signed-off-by: Chris Bono <chris.bono@broadcom.com>
onobc added a commit that referenced this pull request Sep 30, 2025
The rangeWithScores family of methods (zRangeWithScores, zRangeByScoreWithScores, zRevRangeWithScores, zRevRangeByScoreWithScores) were missing from the RedisCommand enumeration, causing ConnectionSplittingInterceptor to resolve them as UNKNOWN commands.

This resulted in read-only methods being incorrectly queued in MULTI/EXEC blocks instead of executing immediately on separate connections, causing them to return null in transactional contexts.

This commit adds the ZRANGEWITHSCORES, ZRANGEBYSCOREWITHSCORES, ZREVRANGEWITHSCORES, ZREVRANGEBYSCOREWITHSCORES enum entries to RedisCommand.java.

The fix ensures these read-only methods are properly recognized and execute immediately in transactional contexts.

Original Pull Request: #3225
Fixes: #3187

Signed-off-by: LeeHyungGeol <rjf1138@naver.com>

(cherry picked from commit 96f250d)

Signed-off-by: Chris Bono <chris.bono@broadcom.com>
onobc added a commit that referenced this pull request Sep 30, 2025
…hods"

Adds convenience method to verify results in the newly added regression test in the previous commit.

Also removes a few warnings in the regression test by suppressing 'rawtypes' and 'unchecked' usages.

Original Pull Request: #3225
Related tickets: #3187

Signed-off-by: Chris Bono <chris.bono@broadcom.com>
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.

rangeWithScores() resolves to RedisCommand.UNKNOWN inside transaction

4 participants