Skip to content
Merged

v9.6.3 #3310

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
run:
concurrency: 8
deadline: 5m
timeout: 5m
tests: false
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,18 @@ By default, go-redis automatically sends the client library name and version dur

#### Disabling Identity Verification

When connection identity verification is not required or needs to be explicitly disabled, a `DisableIndentity` configuration option exists. In V10 of this library, `DisableIndentity` will become `DisableIdentity` in order to fix the associated typo.
When connection identity verification is not required or needs to be explicitly disabled, a `DisableIdentity` configuration option exists.
Initially there was a typo and the option was named `DisableIndentity` instead of `DisableIdentity`. The misspelled option is marked as Deprecated and will be removed in V10 of this library.
Although both options will work at the moment, the correct option is `DisableIdentity`. The deprecated option will be removed in V10 of this library, so please use the correct option name to avoid any issues.

To disable verification, set the `DisableIndentity` option to `true` in the Redis client options:
To disable verification, set the `DisableIdentity` option to `true` in the Redis client options:

```go
rdb := redis.NewClient(&redis.Options{
Addr: "localhost:6379",
Password: "",
DB: 0,
DisableIndentity: true, // Disable set-info on connect
DisableIdentity: true, // Disable set-info on connect
})
```

Expand Down
4 changes: 2 additions & 2 deletions bench_decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func NewClientStub(resp []byte) *ClientStub {
Dialer: func(ctx context.Context, network, addr string) (net.Conn, error) {
return stub.stubConn(initHello), nil
},
DisableIndentity: true,
DisableIdentity: true,
})
return stub
}
Expand All @@ -46,7 +46,7 @@ func NewClusterClientStub(resp []byte) *ClientStub {
Dialer: func(ctx context.Context, network, addr string) (net.Conn, error) {
return stub.stubConn(initHello), nil
},
DisableIndentity: true,
DisableIdentity: true,

ClusterSlots: func(_ context.Context) ([]ClusterSlot, error) {
return []ClusterSlot{
Expand Down
2 changes: 1 addition & 1 deletion example/del-keys-without-ttl/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.18
replace github.com/redis/go-redis/v9 => ../..

require (
github.com/redis/go-redis/v9 v9.6.2
github.com/redis/go-redis/v9 v9.6.3
go.uber.org/zap v1.24.0
)

Expand Down
2 changes: 1 addition & 1 deletion example/hll/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.18

replace github.com/redis/go-redis/v9 => ../..

require github.com/redis/go-redis/v9 v9.6.2
require github.com/redis/go-redis/v9 v9.6.3

require (
github.com/cespare/xxhash/v2 v2.2.0 // indirect
Expand Down
2 changes: 1 addition & 1 deletion example/lua-scripting/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.18

replace github.com/redis/go-redis/v9 => ../..

require github.com/redis/go-redis/v9 v9.6.2
require github.com/redis/go-redis/v9 v9.6.3

require (
github.com/cespare/xxhash/v2 v2.2.0 // indirect
Expand Down
6 changes: 3 additions & 3 deletions example/otel/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ replace github.com/redis/go-redis/extra/redisotel/v9 => ../../extra/redisotel
replace github.com/redis/go-redis/extra/rediscmd/v9 => ../../extra/rediscmd

require (
github.com/redis/go-redis/extra/redisotel/v9 v9.6.2
github.com/redis/go-redis/v9 v9.6.2
github.com/redis/go-redis/extra/redisotel/v9 v9.6.3
github.com/redis/go-redis/v9 v9.6.3
github.com/uptrace/uptrace-go v1.21.0
go.opentelemetry.io/otel v1.22.0
)
Expand All @@ -23,7 +23,7 @@ require (
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect
github.com/redis/go-redis/extra/rediscmd/v9 v9.6.2 // indirect
github.com/redis/go-redis/extra/rediscmd/v9 v9.6.3 // indirect
go.opentelemetry.io/contrib/instrumentation/runtime v0.46.1 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.44.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect
Expand Down
2 changes: 1 addition & 1 deletion example/redis-bloom/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.18

replace github.com/redis/go-redis/v9 => ../..

require github.com/redis/go-redis/v9 v9.6.2
require github.com/redis/go-redis/v9 v9.6.3

require (
github.com/cespare/xxhash/v2 v2.2.0 // indirect
Expand Down
2 changes: 1 addition & 1 deletion example/scan-struct/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ replace github.com/redis/go-redis/v9 => ../..

require (
github.com/davecgh/go-spew v1.1.1
github.com/redis/go-redis/v9 v9.6.2
github.com/redis/go-redis/v9 v9.6.3
)

require (
Expand Down
4 changes: 2 additions & 2 deletions extra/rediscensus/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ replace github.com/redis/go-redis/v9 => ../..
replace github.com/redis/go-redis/extra/rediscmd/v9 => ../rediscmd

require (
github.com/redis/go-redis/extra/rediscmd/v9 v9.6.2
github.com/redis/go-redis/v9 v9.6.2
github.com/redis/go-redis/extra/rediscmd/v9 v9.6.3
github.com/redis/go-redis/v9 v9.6.3
go.opencensus.io v0.24.0
)

Expand Down
2 changes: 1 addition & 1 deletion extra/rediscmd/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ replace github.com/redis/go-redis/v9 => ../..
require (
github.com/bsm/ginkgo/v2 v2.12.0
github.com/bsm/gomega v1.27.10
github.com/redis/go-redis/v9 v9.6.2
github.com/redis/go-redis/v9 v9.6.3
)

require (
Expand Down
4 changes: 2 additions & 2 deletions extra/redisotel/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ replace github.com/redis/go-redis/v9 => ../..
replace github.com/redis/go-redis/extra/rediscmd/v9 => ../rediscmd

require (
github.com/redis/go-redis/extra/rediscmd/v9 v9.6.2
github.com/redis/go-redis/v9 v9.6.2
github.com/redis/go-redis/extra/rediscmd/v9 v9.6.3
github.com/redis/go-redis/v9 v9.6.3
go.opentelemetry.io/otel v1.22.0
go.opentelemetry.io/otel/metric v1.22.0
go.opentelemetry.io/otel/sdk v1.22.0
Expand Down
2 changes: 1 addition & 1 deletion extra/redisprometheus/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ replace github.com/redis/go-redis/v9 => ../..

require (
github.com/prometheus/client_golang v1.14.0
github.com/redis/go-redis/v9 v9.6.2
github.com/redis/go-redis/v9 v9.6.3
)

require (
Expand Down
11 changes: 10 additions & 1 deletion options.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,18 @@ type Options struct {
// Enables read only queries on slave/follower nodes.
readOnly bool

// Disable set-lib on connect. Default is false.
// DisableIndentity - Disable set-lib on connect.
//
// default: false
//
// Deprecated: Use DisableIdentity instead.
DisableIndentity bool

// DisableIdentity is used to disable CLIENT SETINFO command on connect.
//
// default: false
DisableIdentity bool

// Add suffix to client name. Default is empty.
IdentitySuffix string
}
Expand Down
18 changes: 15 additions & 3 deletions osscluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,19 @@ type ClusterOptions struct {
ConnMaxIdleTime time.Duration
ConnMaxLifetime time.Duration

TLSConfig *tls.Config
DisableIndentity bool // Disable set-lib on connect. Default is false.
TLSConfig *tls.Config

// DisableIndentity - Disable set-lib on connect.
//
// default: false
//
// Deprecated: Use DisableIdentity instead.
DisableIndentity bool

// DisableIdentity is used to disable CLIENT SETINFO command on connect.
//
// default: false
DisableIdentity bool

IdentitySuffix string // Add suffix to client name. Default is empty.
}
Expand Down Expand Up @@ -296,7 +307,8 @@ func (opt *ClusterOptions) clientOptions() *Options {
MaxActiveConns: opt.MaxActiveConns,
ConnMaxIdleTime: opt.ConnMaxIdleTime,
ConnMaxLifetime: opt.ConnMaxLifetime,
DisableIndentity: opt.DisableIndentity,
DisableIdentity: opt.DisableIdentity,
DisableIndentity: opt.DisableIdentity,
IdentitySuffix: opt.IdentitySuffix,
TLSConfig: opt.TLSConfig,
// If ClusterSlots is populated, then we probably have an artificial
Expand Down
8 changes: 6 additions & 2 deletions redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ func (c *baseClient) initConn(ctx context.Context, cn *pool.Conn) error {
return err
}

if !c.opt.DisableIndentity {
if !c.opt.DisableIdentity && !c.opt.DisableIndentity {
libName := ""
libVer := Version()
if c.opt.IdentitySuffix != "" {
Expand All @@ -354,7 +354,11 @@ func (c *baseClient) initConn(ctx context.Context, cn *pool.Conn) error {
p := conn.Pipeline()
p.ClientSetInfo(ctx, WithLibraryName(libName))
p.ClientSetInfo(ctx, WithLibraryVersion(libVer))
_, _ = p.Exec(ctx)
// Handle network errors (e.g. timeouts) in CLIENT SETINFO to avoid
// out of order responses later on.
if _, err = p.Exec(ctx); err != nil && !isRedisError(err) {
return err
}
}

if c.opt.OnConnect != nil {
Expand Down
7 changes: 7 additions & 0 deletions redis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,13 @@ var _ = Describe("Client timeout", func() {
})

testTimeout := func() {
It("SETINFO timeouts", func() {
conn := client.Conn()
err := conn.Ping(ctx).Err()
Expect(err).To(HaveOccurred())
Expect(err.(net.Error).Timeout()).To(BeTrue())
})

It("Ping timeouts", func() {
err := client.Ping(ctx).Err()
Expect(err).To(HaveOccurred())
Expand Down
13 changes: 12 additions & 1 deletion ring.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,18 @@ type RingOptions struct {
TLSConfig *tls.Config
Limiter Limiter

// DisableIndentity - Disable set-lib on connect.
//
// default: false
//
// Deprecated: Use DisableIdentity instead.
DisableIndentity bool
IdentitySuffix string

// DisableIdentity is used to disable CLIENT SETINFO command on connect.
//
// default: false
DisableIdentity bool
IdentitySuffix string
}

func (opt *RingOptions) init() {
Expand Down Expand Up @@ -166,6 +176,7 @@ func (opt *RingOptions) clientOptions() *Options {
TLSConfig: opt.TLSConfig,
Limiter: opt.Limiter,

DisableIdentity: opt.DisableIdentity,
DisableIndentity: opt.DisableIndentity,
IdentitySuffix: opt.IdentitySuffix,
}
Expand Down
16 changes: 15 additions & 1 deletion sentinel.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,19 @@ type FailoverOptions struct {

TLSConfig *tls.Config

// DisableIndentity - Disable set-lib on connect.
//
// default: false
//
// Deprecated: Use DisableIdentity instead.
DisableIndentity bool
IdentitySuffix string

// DisableIdentity is used to disable CLIENT SETINFO command on connect.
//
// default: false
DisableIdentity bool

IdentitySuffix string
}

func (opt *FailoverOptions) clientOptions() *Options {
Expand Down Expand Up @@ -117,6 +128,7 @@ func (opt *FailoverOptions) clientOptions() *Options {

TLSConfig: opt.TLSConfig,

DisableIdentity: opt.DisableIdentity,
DisableIndentity: opt.DisableIndentity,
IdentitySuffix: opt.IdentitySuffix,
}
Expand Down Expand Up @@ -154,6 +166,7 @@ func (opt *FailoverOptions) sentinelOptions(addr string) *Options {

TLSConfig: opt.TLSConfig,

DisableIdentity: opt.DisableIdentity,
DisableIndentity: opt.DisableIndentity,
IdentitySuffix: opt.IdentitySuffix,
}
Expand Down Expand Up @@ -194,6 +207,7 @@ func (opt *FailoverOptions) clusterOptions() *ClusterOptions {

TLSConfig: opt.TLSConfig,

DisableIdentity: opt.DisableIdentity,
DisableIndentity: opt.DisableIndentity,
IdentitySuffix: opt.IdentitySuffix,
}
Expand Down
18 changes: 17 additions & 1 deletion universal.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,19 @@ type UniversalOptions struct {

MasterName string

// DisableIndentity - Disable set-lib on connect.
//
// default: false
//
// Deprecated: Use DisableIdentity instead.
DisableIndentity bool
IdentitySuffix string

// DisableIdentity is used to disable CLIENT SETINFO command on connect.
//
// default: false
DisableIdentity bool

IdentitySuffix string
}

// Cluster returns cluster options created from the universal options.
Expand Down Expand Up @@ -112,6 +123,7 @@ func (o *UniversalOptions) Cluster() *ClusterOptions {

TLSConfig: o.TLSConfig,

DisableIdentity: o.DisableIdentity,
DisableIndentity: o.DisableIndentity,
IdentitySuffix: o.IdentitySuffix,
}
Expand Down Expand Up @@ -158,6 +170,9 @@ func (o *UniversalOptions) Failover() *FailoverOptions {

TLSConfig: o.TLSConfig,

ReplicaOnly: o.ReadOnly,

DisableIdentity: o.DisableIdentity,
DisableIndentity: o.DisableIndentity,
IdentitySuffix: o.IdentitySuffix,
}
Expand Down Expand Up @@ -201,6 +216,7 @@ func (o *UniversalOptions) Simple() *Options {

TLSConfig: o.TLSConfig,

DisableIdentity: o.DisableIdentity,
DisableIndentity: o.DisableIndentity,
IdentitySuffix: o.IdentitySuffix,
}
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package redis

// Version is the current release version.
func Version() string {
return "9.6.2"
return "9.6.3"
}
Loading