Skip to content

chore(deps): replace stale dependency github.com/go-redis/redis/v8#7010

Draft
stoewer wants to merge 3 commits intografana:mainfrom
stoewer:replace-stale-dep-go-redis
Draft

chore(deps): replace stale dependency github.com/go-redis/redis/v8#7010
stoewer wants to merge 3 commits intografana:mainfrom
stoewer:replace-stale-dep-go-redis

Conversation

@stoewer
Copy link
Copy Markdown
Contributor

@stoewer stoewer commented Apr 20, 2026

What this PR does:
Upgrades github.com/go-redis/redis/v8 to github.com/redis/go-redis/v9 (the module path changed when the org was renamed from go-redis to redis). The two renamed UniversalOptions fields (IdleTimeoutConnMaxIdleTime, MaxConnAgeConnMaxLifetime) are updated accordingly. In cluster mode, MSet now uses a non-transactional pipeline to avoid CROSSSLOT slot constraint errors, consistent with the existing approach in MGet.

Which issue(s) this PR fixes:
N/A

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Copilot AI review requested due to automatic review settings April 20, 2026 11:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR migrates the project from github.com/go-redis/redis/v8 to the renamed module github.com/redis/go-redis/v9, updates option field names accordingly, and adjusts MSet behavior in Redis Cluster mode to avoid CROSSSLOT transaction errors.

Changes:

  • Switch imports from go-redis/redis/v8 to redis/go-redis/v9.
  • Update UniversalOptions field names (IdleTimeoutConnMaxIdleTime, MaxConnAgeConnMaxLifetime).
  • In MSet, use a non-transactional pipeline when the client is a ClusterClient to avoid cross-slot transaction failures.

Reviewed changes

Copilot reviewed 4 out of 145 changed files in this pull request and generated 3 comments.

File Description
pkg/cache/redis_client.go Updates redis client options for v9 and changes MSet pipelining behavior for cluster clients.
pkg/cache/redis_cache.go Updates go-redis import path to v9.
pkg/cache/redis_cache_test.go Updates go-redis import path to v9 for tests.
go.mod Replaces v8 dependency with github.com/redis/go-redis/v9.

Comment thread pkg/cache/redis_client.go
Comment on lines +112 to +120
// In cluster mode, cross-slot transactions are not supported. Use a non-transactional
// pipeline to allow keys on different slots, consistent with how MGet handles clusters.
_, isCluster := c.rdb.(*redis.ClusterClient)
var pipe redis.Pipeliner
if isCluster {
pipe = c.rdb.Pipeline()
} else {
pipe = c.rdb.TxPipeline()
}
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HIGH: This changes MSet semantics in cluster mode from (per-node) transactional to non-transactional, which can lead to partial writes if some SETs fail. If callers rely on MSet being all-or-nothing, consider either (a) documenting explicitly that cluster-mode MSet is best-effort/non-atomic, or (b) preserving atomicity when possible (e.g., if all keys map to the same hash slot, use a transaction; otherwise fall back to non-transactional pipeline).

Copilot uses AI. Check for mistakes.
Comment thread pkg/cache/redis_client.go Outdated
Comment thread pkg/cache/redis_client.go
Comment on lines +112 to +120
// In cluster mode, cross-slot transactions are not supported. Use a non-transactional
// pipeline to allow keys on different slots, consistent with how MGet handles clusters.
_, isCluster := c.rdb.(*redis.ClusterClient)
var pipe redis.Pipeliner
if isCluster {
pipe = c.rdb.Pipeline()
} else {
pipe = c.rdb.TxPipeline()
}
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MEDIUM: The new cluster-specific behavior in MSet isn’t covered by tests. Since this is a behavioral change (avoiding CROSSSLOT by removing transactions in cluster mode), add a test that exercises the cluster/non-cluster branching. If it’s hard to stand up a real Redis Cluster in unit tests, consider extracting pipeline selection into a small helper and unit-testing that helper with a minimal stub.

Copilot generated this review using guidance from repository custom instructions.
@stoewer stoewer force-pushed the replace-stale-dep-go-redis branch from 315d30e to 8c748f9 Compare April 22, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants