Multiple Redis 6.0/6.2 commands fail without version compatibility check
Closed this issue · 3 comments
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.
Spring Data Redis 2.6 and Redis 6 are quite dated. Not sure what you're asking for and as this report looks like AI slop, I'm inclined to close this one immediately.
Sorry for using AI to help with my English. I'll repost this issue with more examples added.
Sorry for using AI to help with my English.
Using AI is not a problem to improve and help yourself. The problem is that AI generates a lot of unrelated content and the shear amount of content makes it very difficult and time consuming for us to understand what you want to tell us.