Bump github.com/redis/go-redis/v9 from 9.5.4 to 9.6.1

Bumps [github.com/redis/go-redis/v9](https://github.com/redis/go-redis) from 9.5.4 to 9.6.1.
- [Release notes](https://github.com/redis/go-redis/releases)
- [Changelog](https://github.com/redis/go-redis/blob/master/CHANGELOG.md)
- [Commits](https://github.com/redis/go-redis/compare/v9.5.4...v9.6.1)

---
updated-dependencies:
- dependency-name: github.com/redis/go-redis/v9
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot] 2024-07-25 12:44:23 +00:00 committed by GitHub
parent 9a2774538f
commit 1fd8b7577b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 56 additions and 2365 deletions

2
go.mod
View file

@ -17,7 +17,7 @@ require (
github.com/lib/pq v1.10.9 github.com/lib/pq v1.10.9
github.com/pkg/errors v0.9.1 github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.19.1 github.com/prometheus/client_golang v1.19.1
github.com/redis/go-redis/v9 v9.5.4 github.com/redis/go-redis/v9 v9.6.1
) )
require ( require (

4
go.sum
View file

@ -124,8 +124,8 @@ github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G
github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8=
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
github.com/redis/go-redis/v9 v9.5.4 h1:vOFYDKKVgrI5u++QvnMT7DksSMYg7Aw/Np4vLJLKLwY= github.com/redis/go-redis/v9 v9.6.1 h1:HHDteefn6ZkTtY5fGUE8tj8uy85AHk6zP7CpzIAM0y4=
github.com/redis/go-redis/v9 v9.5.4/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M= github.com/redis/go-redis/v9 v9.6.1/go.mod h1:0C0c6ycQsdpVNQpxb1njEQIqkx5UcsM8FJCQLgE9+RA=
github.com/rogpeppe/fastuuid v1.1.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/fastuuid v1.1.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM=

View file

@ -3787,65 +3787,6 @@ func (cmd *MapStringStringSliceCmd) readReply(rd *proto.Reader) error {
return nil return nil
} }
// -----------------------------------------------------------------------
// MapStringInterfaceCmd represents a command that returns a map of strings to interface{}.
type MapMapStringInterfaceCmd struct {
baseCmd
val map[string]interface{}
}
func NewMapMapStringInterfaceCmd(ctx context.Context, args ...interface{}) *MapMapStringInterfaceCmd {
return &MapMapStringInterfaceCmd{
baseCmd: baseCmd{
ctx: ctx,
args: args,
},
}
}
func (cmd *MapMapStringInterfaceCmd) String() string {
return cmdString(cmd, cmd.val)
}
func (cmd *MapMapStringInterfaceCmd) SetVal(val map[string]interface{}) {
cmd.val = val
}
func (cmd *MapMapStringInterfaceCmd) Result() (map[string]interface{}, error) {
return cmd.val, cmd.err
}
func (cmd *MapMapStringInterfaceCmd) Val() map[string]interface{} {
return cmd.val
}
func (cmd *MapMapStringInterfaceCmd) readReply(rd *proto.Reader) (err error) {
n, err := rd.ReadArrayLen()
if err != nil {
return err
}
data := make(map[string]interface{}, n/2)
for i := 0; i < n; i += 2 {
_, err := rd.ReadArrayLen()
if err != nil {
cmd.err = err
}
key, err := rd.ReadString()
if err != nil {
cmd.err = err
}
value, err := rd.ReadString()
if err != nil {
cmd.err = err
}
data[key] = value
}
cmd.val = data
return nil
}
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
type MapStringInterfaceSliceCmd struct { type MapStringInterfaceSliceCmd struct {

View file

@ -220,7 +220,6 @@ type Cmdable interface {
ProbabilisticCmdable ProbabilisticCmdable
PubSubCmdable PubSubCmdable
ScriptingFunctionsCmdable ScriptingFunctionsCmdable
SearchCmdable
SetCmdable SetCmdable
SortedSetCmdable SortedSetCmdable
StringCmdable StringCmdable

View file

@ -3,8 +3,10 @@ package pool
import ( import (
"bufio" "bufio"
"context" "context"
"crypto/tls"
"net" "net"
"sync/atomic" "sync/atomic"
"syscall"
"time" "time"
"github.com/redis/go-redis/v9/internal/proto" "github.com/redis/go-redis/v9/internal/proto"
@ -16,6 +18,9 @@ type Conn struct {
usedAt int64 // atomic usedAt int64 // atomic
netConn net.Conn netConn net.Conn
// for checking the health status of the connection, it may be nil.
sysConn syscall.Conn
rd *proto.Reader rd *proto.Reader
bw *bufio.Writer bw *bufio.Writer
wr *proto.Writer wr *proto.Writer
@ -34,6 +39,7 @@ func NewConn(netConn net.Conn) *Conn {
cn.bw = bufio.NewWriter(netConn) cn.bw = bufio.NewWriter(netConn)
cn.wr = proto.NewWriter(cn.bw) cn.wr = proto.NewWriter(cn.bw)
cn.SetUsedAt(time.Now()) cn.SetUsedAt(time.Now())
cn.setSysConn()
return cn return cn
} }
@ -50,6 +56,22 @@ func (cn *Conn) SetNetConn(netConn net.Conn) {
cn.netConn = netConn cn.netConn = netConn
cn.rd.Reset(netConn) cn.rd.Reset(netConn)
cn.bw.Reset(netConn) cn.bw.Reset(netConn)
cn.setSysConn()
}
func (cn *Conn) setSysConn() {
cn.sysConn = nil
conn := cn.netConn
if conn == nil {
return
}
if tlsConn, ok := conn.(*tls.Conn); ok {
conn = tlsConn.NetConn()
}
if sysConn, ok := conn.(syscall.Conn); ok {
cn.sysConn = sysConn
}
} }
func (cn *Conn) Write(b []byte) (int, error) { func (cn *Conn) Write(b []byte) (int, error) {

View file

@ -3,28 +3,14 @@
package pool package pool
import ( import (
"crypto/tls"
"errors" "errors"
"io" "io"
"net"
"syscall" "syscall"
"time"
) )
var errUnexpectedRead = errors.New("unexpected read from socket") var errUnexpectedRead = errors.New("unexpected read from socket")
func connCheck(conn net.Conn) error { func connCheck(sysConn syscall.Conn) error {
// Reset previous timeout.
_ = conn.SetDeadline(time.Time{})
// Check if tls.Conn.
if c, ok := conn.(*tls.Conn); ok {
conn = c.NetConn()
}
sysConn, ok := conn.(syscall.Conn)
if !ok {
return nil
}
rawConn, err := sysConn.SyscallConn() rawConn, err := sysConn.SyscallConn()
if err != nil { if err != nil {
return err return err

View file

@ -2,8 +2,8 @@
package pool package pool
import "net" import "syscall"
func connCheck(conn net.Conn) error { func connCheck(_ syscall.Conn) error {
return nil return nil
} }

View file

@ -499,6 +499,8 @@ func (p *ConnPool) Close() error {
return firstErr return firstErr
} }
var zeroTime = time.Time{}
func (p *ConnPool) isHealthyConn(cn *Conn) bool { func (p *ConnPool) isHealthyConn(cn *Conn) bool {
now := time.Now() now := time.Now()
@ -509,9 +511,13 @@ func (p *ConnPool) isHealthyConn(cn *Conn) bool {
return false return false
} }
if connCheck(cn.netConn) != nil { if cn.sysConn != nil {
// reset previous timeout.
_ = cn.netConn.SetDeadline(zeroTime)
if connCheck(cn.sysConn) != nil {
return false return false
} }
}
cn.SetUsedAt(now) cn.SetUsedAt(now)
return true return true

View file

@ -3,7 +3,6 @@ package internal
import ( import (
"context" "context"
"net" "net"
"strconv"
"strings" "strings"
"time" "time"
@ -82,47 +81,3 @@ func GetAddr(addr string) string {
} }
return net.JoinHostPort(addr[:ind], addr[ind+1:]) return net.JoinHostPort(addr[:ind], addr[ind+1:])
} }
func ToInteger(val interface{}) int {
switch v := val.(type) {
case int:
return v
case int64:
return int(v)
case string:
i, _ := strconv.Atoi(v)
return i
default:
return 0
}
}
func ToFloat(val interface{}) float64 {
switch v := val.(type) {
case float64:
return v
case string:
f, _ := strconv.ParseFloat(v, 64)
return f
default:
return 0.0
}
}
func ToString(val interface{}) string {
if str, ok := val.(string); ok {
return str
}
return ""
}
func ToStringSlice(val interface{}) []string {
if arr, ok := val.([]interface{}); ok {
result := make([]string, len(arr))
for i, v := range arr {
result[i] = ToString(v)
}
return result
}
return nil
}

View file

@ -938,10 +938,13 @@ func (c *ClusterClient) Process(ctx context.Context, cmd Cmder) error {
func (c *ClusterClient) process(ctx context.Context, cmd Cmder) error { func (c *ClusterClient) process(ctx context.Context, cmd Cmder) error {
slot := c.cmdSlot(ctx, cmd) slot := c.cmdSlot(ctx, cmd)
var node *clusterNode var node *clusterNode
var moved bool
var ask bool var ask bool
var lastErr error var lastErr error
for attempt := 0; attempt <= c.opt.MaxRedirects; attempt++ { for attempt := 0; attempt <= c.opt.MaxRedirects; attempt++ {
if attempt > 0 { // MOVED and ASK responses are not transient errors that require retry delay; they
// should be attempted immediately.
if attempt > 0 && !moved && !ask {
if err := internal.Sleep(ctx, c.retryBackoff(attempt)); err != nil { if err := internal.Sleep(ctx, c.retryBackoff(attempt)); err != nil {
return err return err
} }
@ -985,7 +988,6 @@ func (c *ClusterClient) process(ctx context.Context, cmd Cmder) error {
continue continue
} }
var moved bool
var addr string var addr string
moved, ask, addr = isMovedError(lastErr) moved, ask, addr = isMovedError(lastErr)
if moved || ask { if moved || ask {

File diff suppressed because it is too large Load diff

View file

@ -45,18 +45,13 @@ type TSOptions struct {
Encoding string Encoding string
DuplicatePolicy string DuplicatePolicy string
Labels map[string]string Labels map[string]string
IgnoreMaxTimeDiff int64
IgnoreMaxValDiff float64
} }
type TSIncrDecrOptions struct { type TSIncrDecrOptions struct {
Timestamp int64 Timestamp int64
Retention int Retention int
ChunkSize int ChunkSize int
Uncompressed bool Uncompressed bool
DuplicatePolicy string
Labels map[string]string Labels map[string]string
IgnoreMaxTimeDiff int64
IgnoreMaxValDiff float64
} }
type TSAlterOptions struct { type TSAlterOptions struct {
@ -64,8 +59,6 @@ type TSAlterOptions struct {
ChunkSize int ChunkSize int
DuplicatePolicy string DuplicatePolicy string
Labels map[string]string Labels map[string]string
IgnoreMaxTimeDiff int64
IgnoreMaxValDiff float64
} }
type TSCreateRuleOptions struct { type TSCreateRuleOptions struct {
@ -230,9 +223,6 @@ func (c cmdable) TSAddWithArgs(ctx context.Context, key string, timestamp interf
args = append(args, label, value) args = append(args, label, value)
} }
} }
if options.IgnoreMaxTimeDiff != 0 || options.IgnoreMaxValDiff != 0 {
args = append(args, "IGNORE", options.IgnoreMaxTimeDiff, options.IgnoreMaxValDiff)
}
} }
cmd := NewIntCmd(ctx, args...) cmd := NewIntCmd(ctx, args...)
_ = c(ctx, cmd) _ = c(ctx, cmd)
@ -274,9 +264,6 @@ func (c cmdable) TSCreateWithArgs(ctx context.Context, key string, options *TSOp
args = append(args, label, value) args = append(args, label, value)
} }
} }
if options.IgnoreMaxTimeDiff != 0 || options.IgnoreMaxValDiff != 0 {
args = append(args, "IGNORE", options.IgnoreMaxTimeDiff, options.IgnoreMaxValDiff)
}
} }
cmd := NewStatusCmd(ctx, args...) cmd := NewStatusCmd(ctx, args...)
_ = c(ctx, cmd) _ = c(ctx, cmd)
@ -305,9 +292,6 @@ func (c cmdable) TSAlter(ctx context.Context, key string, options *TSAlterOption
args = append(args, label, value) args = append(args, label, value)
} }
} }
if options.IgnoreMaxTimeDiff != 0 || options.IgnoreMaxValDiff != 0 {
args = append(args, "IGNORE", options.IgnoreMaxTimeDiff, options.IgnoreMaxValDiff)
}
} }
cmd := NewStatusCmd(ctx, args...) cmd := NewStatusCmd(ctx, args...)
_ = c(ctx, cmd) _ = c(ctx, cmd)
@ -367,18 +351,12 @@ func (c cmdable) TSIncrByWithArgs(ctx context.Context, key string, timestamp flo
if options.Uncompressed { if options.Uncompressed {
args = append(args, "UNCOMPRESSED") args = append(args, "UNCOMPRESSED")
} }
if options.DuplicatePolicy != "" {
args = append(args, "DUPLICATE_POLICY", options.DuplicatePolicy)
}
if options.Labels != nil { if options.Labels != nil {
args = append(args, "LABELS") args = append(args, "LABELS")
for label, value := range options.Labels { for label, value := range options.Labels {
args = append(args, label, value) args = append(args, label, value)
} }
} }
if options.IgnoreMaxTimeDiff != 0 || options.IgnoreMaxValDiff != 0 {
args = append(args, "IGNORE", options.IgnoreMaxTimeDiff, options.IgnoreMaxValDiff)
}
} }
cmd := NewIntCmd(ctx, args...) cmd := NewIntCmd(ctx, args...)
_ = c(ctx, cmd) _ = c(ctx, cmd)
@ -413,18 +391,12 @@ func (c cmdable) TSDecrByWithArgs(ctx context.Context, key string, timestamp flo
if options.Uncompressed { if options.Uncompressed {
args = append(args, "UNCOMPRESSED") args = append(args, "UNCOMPRESSED")
} }
if options.DuplicatePolicy != "" {
args = append(args, "DUPLICATE_POLICY", options.DuplicatePolicy)
}
if options.Labels != nil { if options.Labels != nil {
args = append(args, "LABELS") args = append(args, "LABELS")
for label, value := range options.Labels { for label, value := range options.Labels {
args = append(args, label, value) args = append(args, label, value)
} }
} }
if options.IgnoreMaxTimeDiff != 0 || options.IgnoreMaxValDiff != 0 {
args = append(args, "IGNORE", options.IgnoreMaxTimeDiff, options.IgnoreMaxValDiff)
}
} }
cmd := NewIntCmd(ctx, args...) cmd := NewIntCmd(ctx, args...)
_ = c(ctx, cmd) _ = c(ctx, cmd)

View file

@ -2,5 +2,5 @@ package redis
// Version is the current release version. // Version is the current release version.
func Version() string { func Version() string {
return "9.5.3" return "9.6.1"
} }

2
vendor/modules.txt vendored
View file

@ -193,7 +193,7 @@ github.com/prometheus/common/model
github.com/prometheus/procfs github.com/prometheus/procfs
github.com/prometheus/procfs/internal/fs github.com/prometheus/procfs/internal/fs
github.com/prometheus/procfs/internal/util github.com/prometheus/procfs/internal/util
# github.com/redis/go-redis/v9 v9.5.4 # github.com/redis/go-redis/v9 v9.6.1
## explicit; go 1.18 ## explicit; go 1.18
github.com/redis/go-redis/v9 github.com/redis/go-redis/v9
github.com/redis/go-redis/v9/internal github.com/redis/go-redis/v9/internal