-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
status: waiting-for-feedbackWe need additional information before we can continueWe need additional information before we can continuestatus: waiting-for-triageAn issue we've not yet triagedAn issue we've not yet triaged
Description
Summary
Spring Data Redis 2.6+ introduces support for Redis 6.0/6.2 commands but lacks version compatibility checks, causing runtime failures when these methods are used against older Redis servers.
Current Behavior
The following Spring Data Redis methods directly send Redis 6.0/6.2 commands without checking server version compatibility:
Redis 6.0+ Commands (failing on Redis < 6.0)
redisTemplate.copy(sourceKey, targetKey)→ERR unknown command 'COPY'redisTemplate.opsForList().move(src, dest, direction)→ERR unknown command 'LMOVE'redisTemplate.opsForZSet().randomMember(key)→ERR unknown command 'ZRANDMEMBER'redisTemplate.opsForHash().randomField(key)→ERR unknown command 'HRANDFIELD'redisTemplate.opsForSet().isMember(key, members...)→ERR unknown command 'SMISMEMBER'
Redis 6.2+ Commands (failing on Redis < 6.2)
redisTemplate.opsForValue().getAndDelete(key)→ERR unknown command 'GETDEL'redisTemplate.opsForValue().getAndExpire(key, timeout)→ERR unknown command 'GETEX'redisTemplate.opsForZSet().score(key, members...)→ERR unknown command 'ZMSCORE'
Expected Behavior
- Automatic detection of Redis server version capabilities
- Graceful fallback to equivalent command combinations for unsupported commands
- No runtime failures due to version incompatibilities
Reproduction Steps
- Set up Redis server < 6.0 or < 6.2
- Use Spring Data Redis 2.6+
- Call any of the affected methods listed above
- Observe
ERR unknown commandexceptions
Environment
- Spring Data Redis: 2.6+
- Redis Server: < 6.0 or < 6.2 depending on command
- Impact: Production environments using legacy Redis versions
Existing Patterns
Spring Data Redis already implements similar version-based compatibility for:
SCANvsKEYScommand selectionEVALSHAwith automatic fallback toEVAL
Contribution Interest
I would be interested in contributing a solution for this issue if the Spring Data Redis team considers this a valid enhancement.
Metadata
Metadata
Assignees
Labels
status: waiting-for-feedbackWe need additional information before we can continueWe need additional information before we can continuestatus: waiting-for-triageAn issue we've not yet triagedAn issue we've not yet triaged