Skip to content

Commit 684f34d

Browse files
committed
Merge branch 'master' into struct-to-hashset
2 parents 913936b + d4e63b4 commit 684f34d

File tree

133 files changed

+9452
-4087
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+9452
-4087
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
custom: ['https://uptrace.dev']
1+
custom: ['https://uptrace.dev/sponsor']

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@ contact_links:
33
- name: Discussions
44
url: https://github.com/go-redis/redis/discussions
55
about: Ask a question via GitHub Discussions
6-
- name: Discord
7-
url: https://discord.gg/rWtp5Aj
8-
about: Ask a question via Discord

.github/workflows/build.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ name: Go
22

33
on:
44
push:
5-
branches: [master]
5+
branches: [master, v9]
66
pull_request:
7-
branches: [master]
7+
branches: [master, v9]
8+
9+
permissions:
10+
contents: read
811

912
jobs:
1013
build:
@@ -13,7 +16,7 @@ jobs:
1316
strategy:
1417
fail-fast: false
1518
matrix:
16-
go-version: [1.16.x, 1.17.x]
19+
go-version: [1.18.x, 1.19.x]
1720

1821
services:
1922
redis:
@@ -25,12 +28,12 @@ jobs:
2528

2629
steps:
2730
- name: Set up ${{ matrix.go-version }}
28-
uses: actions/setup-go@v2
31+
uses: actions/setup-go@v3
2932
with:
3033
go-version: ${{ matrix.go-version }}
3134

3235
- name: Checkout code
33-
uses: actions/checkout@v2
36+
uses: actions/checkout@v3
3437

3538
- name: Test
3639
run: make test

.github/workflows/commitlint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
commitlint:
66
runs-on: ubuntu-latest
77
steps:
8-
- uses: actions/checkout@v2
8+
- uses: actions/checkout@v3
99
with:
1010
fetch-depth: 0
11-
- uses: wagoid/commitlint-github-action@v4
11+
- uses: wagoid/commitlint-github-action@v5

.github/workflows/golangci-lint.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,20 @@ on:
77
branches:
88
- master
99
- main
10+
- v9
1011
pull_request:
1112

13+
permissions:
14+
contents: read
15+
1216
jobs:
1317
golangci:
18+
permissions:
19+
contents: read # for actions/checkout to fetch code
20+
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
1421
name: lint
1522
runs-on: ubuntu-latest
1623
steps:
17-
- uses: actions/checkout@v2
24+
- uses: actions/checkout@v3
1825
- name: golangci-lint
19-
uses: golangci/golangci-lint-action@v2
26+
uses: golangci/golangci-lint-action@v3

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
build:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v3
1313
- uses: ncipollo/release-action@v1
1414
with:
1515
body:

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
*.rdb
2-
testdata/*/
2+
testdata/*
33
.idea/

CHANGELOG.md

Lines changed: 40 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -1,149 +1,55 @@
1-
## [8.11.4](https://github.com/go-redis/redis/compare/v8.11.3...v8.11.4) (2021-10-04)
1+
# [9.0.0-rc.2](https://github.com/go-redis/redis/compare/v9.0.0-rc.1...v9.0.0-rc.2) (2022-11-26)
22

33

4-
### Features
5-
6-
* add acl auth support for sentinels ([f66582f](https://github.com/go-redis/redis/commit/f66582f44f3dc3a4705a5260f982043fde4aa634))
7-
* add Cmd.{String,Int,Float,Bool}Slice helpers and an example ([5d3d293](https://github.com/go-redis/redis/commit/5d3d293cc9c60b90871e2420602001463708ce24))
8-
* add SetVal method for each command ([168981d](https://github.com/go-redis/redis/commit/168981da2d84ee9e07d15d3e74d738c162e264c4))
9-
10-
11-
12-
## v8.11
13-
14-
- Remove OpenTelemetry metrics.
15-
- Supports more redis commands and options.
16-
17-
## v8.10
18-
19-
- Removed extra OpenTelemetry spans from go-redis core. Now go-redis instrumentation only adds a
20-
single span with a Redis command (instead of 4 spans). There are multiple reasons behind this
21-
decision:
22-
23-
- Traces become smaller and less noisy.
24-
- It may be costly to process those 3 extra spans for each query.
25-
- go-redis no longer depends on OpenTelemetry.
26-
27-
Eventually we hope to replace the information that we no longer collect with OpenTelemetry
28-
Metrics.
29-
30-
## v8.9
31-
32-
- Changed `PubSub.Channel` to only rely on `Ping` result. You can now use `WithChannelSize`,
33-
`WithChannelHealthCheckInterval`, and `WithChannelSendTimeout` to override default settings.
34-
35-
## v8.8
36-
37-
- To make updating easier, extra modules now have the same version as go-redis does. That means that
38-
you need to update your imports:
39-
40-
```
41-
github.com/go-redis/redis/extra/redisotel -> github.com/go-redis/redis/extra/redisotel/v8
42-
github.com/go-redis/redis/extra/rediscensus -> github.com/go-redis/redis/extra/rediscensus/v8
43-
```
44-
45-
## v8.5
46-
47-
- [knadh](https://github.com/knadh) contributed long-awaited ability to scan Redis Hash into a
48-
struct:
49-
50-
```go
51-
err := rdb.HGetAll(ctx, "hash").Scan(&data)
4+
### Bug Fixes
525

53-
err := rdb.MGet(ctx, "key1", "key2").Scan(&data)
54-
```
6+
* capture error correctly in withConn ([d1bfaba](https://github.com/go-redis/redis/commit/d1bfaba549fe380d269c26cea0a0183ed1520a85))
7+
* fixes ring.SetAddrs and rebalance race ([#2283](https://github.com/go-redis/redis/issues/2283)) ([d83436b](https://github.com/go-redis/redis/commit/d83436b321cd9ed52ba33c3edbe8f63bb0444c59))
8+
* read in route_randomly query param correctly ([f236053](https://github.com/go-redis/redis/commit/f236053735d10aec5e6e31fc3ced1b2e53292554))
9+
* reduce `SetAddrs` shards lock contention ([6c05a9f](https://github.com/go-redis/redis/commit/6c05a9f6b17f8e32593d3f7d594f82ba3dbcafb1)), closes [/github.com/go-redis/redis/pull/2190#discussion_r953040289](https://github.com//github.com/go-redis/redis/pull/2190/issues/discussion_r953040289) [#2077](https://github.com/go-redis/redis/issues/2077)
10+
* wrap cmds in Conn.TxPipeline ([5053db2](https://github.com/go-redis/redis/commit/5053db2f9c8b3ca25f497a75f70012c7ad6cd775))
5511

56-
- Please check [redismock](https://github.com/go-redis/redismock) by
57-
[monkey92t](https://github.com/monkey92t) if you are looking for mocking Redis Client.
5812

59-
## v8
60-
61-
- All commands require `context.Context` as a first argument, e.g. `rdb.Ping(ctx)`. If you are not
62-
using `context.Context` yet, the simplest option is to define global package variable
63-
`var ctx = context.TODO()` and use it when `ctx` is required.
64-
65-
- Full support for `context.Context` canceling.
66-
67-
- Added `redis.NewFailoverClusterClient` that supports routing read-only commands to a slave node.
68-
69-
- Added `redisext.OpenTemetryHook` that adds
70-
[Redis OpenTelemetry instrumentation](https://redis.uptrace.dev/tracing/).
71-
72-
- Redis slow log support.
73-
74-
- Ring uses Rendezvous Hashing by default which provides better distribution. You need to move
75-
existing keys to a new location or keys will be inaccessible / lost. To use old hashing scheme:
76-
77-
```go
78-
import "github.com/golang/groupcache/consistenthash"
79-
80-
ring := redis.NewRing(&redis.RingOptions{
81-
NewConsistentHash: func() {
82-
return consistenthash.New(100, crc32.ChecksumIEEE)
83-
},
84-
})
85-
```
86-
87-
- `ClusterOptions.MaxRedirects` default value is changed from 8 to 3.
88-
- `Options.MaxRetries` default value is changed from 0 to 3.
89-
90-
- `Cluster.ForEachNode` is renamed to `ForEachShard` for consistency with `Ring`.
91-
92-
## v7.3
93-
94-
- New option `Options.Username` which causes client to use `AuthACL`. Be aware if your connection
95-
URL contains username.
96-
97-
## v7.2
98-
99-
- Existing `HMSet` is renamed to `HSet` and old deprecated `HMSet` is restored for Redis 3 users.
100-
101-
## v7.1
102-
103-
- Existing `Cmd.String` is renamed to `Cmd.Text`. New `Cmd.String` implements `fmt.Stringer`
104-
interface.
13+
### Features
10514

106-
## v7
15+
* add HasErrorPrefix ([d3d8002](https://github.com/go-redis/redis/commit/d3d8002e894a1eab5bab2c9fff13439527e330d8))
16+
* add support for SINTERCARD command ([bc51c61](https://github.com/go-redis/redis/commit/bc51c61a458d1bc4fb4424c7c3e912325ef980cc))
10717

108-
- _Important_. Tx.Pipeline now returns a non-transactional pipeline. Use Tx.TxPipeline for a
109-
transactional pipeline.
110-
- WrapProcess is replaced with more convenient AddHook that has access to context.Context.
111-
- WithContext now can not be used to create a shallow copy of the client.
112-
- New methods ProcessContext, DoContext, and ExecContext.
113-
- Client respects Context.Deadline when setting net.Conn deadline.
114-
- Client listens on Context.Done while waiting for a connection from the pool and returns an error
115-
when context context is cancelled.
116-
- Add PubSub.ChannelWithSubscriptions that sends `*Subscription` in addition to `*Message` to allow
117-
detecting reconnections.
118-
- `time.Time` is now marshalled in RFC3339 format. `rdb.Get("foo").Time()` helper is added to parse
119-
the time.
120-
- `SetLimiter` is removed and added `Options.Limiter` instead.
121-
- `HMSet` is deprecated as of Redis v4.
12218

123-
## v6.15
12419

125-
- Cluster and Ring pipelines process commands for each node in its own goroutine.
20+
## v9 UNRELEASED
12621

127-
## 6.14
22+
### Added
12823

129-
- Added Options.MinIdleConns.
130-
- Added Options.MaxConnAge.
131-
- PoolStats.FreeConns is renamed to PoolStats.IdleConns.
132-
- Add Client.Do to simplify creating custom commands.
133-
- Add Cmd.String, Cmd.Int, Cmd.Int64, Cmd.Uint64, Cmd.Float64, and Cmd.Bool helpers.
134-
- Lower memory usage.
24+
- Added support for [RESP3](https://github.com/antirez/RESP3/blob/master/spec.md) protocol.
25+
Contributed by @monkey92t who has done a lot of work recently.
26+
- Added `ContextTimeoutEnabled` option that controls whether the client respects context timeouts
27+
and deadlines. See
28+
[Redis Timeouts](https://redis.uptrace.dev/guide/go-redis-debugging.html#timeouts) for details.
29+
- Added `ParseClusterURL` to parse URLs into `ClusterOptions`, for example,
30+
`redis://user:password@localhost:6789?dial_timeout=3&read_timeout=6s&addr=localhost:6790&addr=localhost:6791`.
31+
- Added metrics instrumentation using `redisotel.IstrumentMetrics`. See
32+
[documentation](https://redis.uptrace.dev/guide/go-redis-monitoring.html)
13533

136-
## v6.13
34+
### Changed
13735

138-
- Ring got new options called `HashReplicas` and `Hash`. It is recommended to set
139-
`HashReplicas = 1000` for better keys distribution between shards.
140-
- Cluster client was optimized to use much less memory when reloading cluster state.
141-
- PubSub.ReceiveMessage is re-worked to not use ReceiveTimeout so it does not lose data when timeout
142-
occurres. In most cases it is recommended to use PubSub.Channel instead.
143-
- Dialer.KeepAlive is set to 5 minutes by default.
36+
- Removed asynchronous cancellation based on the context timeout. It was racy in v8 and is
37+
completely gone in v9.
38+
- Reworked hook interface and added `DialHook`.
39+
- Replaced `redisotel.NewTracingHook` with `redisotel.InstrumentTracing`. See
40+
[example](example/otel) and
41+
[documentation](https://redis.uptrace.dev/guide/go-redis-monitoring.html).
42+
- Replaced `*redis.Z` with `redis.Z` since it is small enough to be passed as value without making
43+
an allocation.
44+
- Renamed the option `MaxConnAge` to `ConnMaxLifetime`.
45+
- Renamed the option `IdleTimeout` to `ConnMaxIdleTime`.
46+
- Removed connection reaper in favor of `MaxIdleConns`.
47+
- Removed `WithContext` since `context.Context` can be passed directly as an arg.
48+
- Removed `Pipeline.Close` since there is no real need to explicitly manage pipeline resources and
49+
it can be safely reused via `sync.Pool` etc. `Pipeline.Discard` is still available if you want to
50+
reset commands for some reason.
14451

145-
## v6.12
52+
### Fixed
14653

147-
- ClusterClient got new option called `ClusterSlots` which allows to build cluster of normal Redis
148-
Servers that don't have cluster mode enabled. See
149-
https://godoc.org/github.com/go-redis/redis#example-NewClusterClient--ManualSetup
54+
- Improved and fixed pipeline retries.
55+
- As usual, added more commands and fixed some bugs.

Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ test: testdeps
66
go test ./... -run=NONE -bench=. -benchmem
77
env GOOS=linux GOARCH=386 go test ./...
88
go vet
9+
cd internal/customvet && go build .
10+
go vet -vettool ./internal/customvet/customvet
911

1012
testdeps: testdata/redis/src/redis-server
1113

@@ -16,7 +18,7 @@ bench: testdeps
1618

1719
testdata/redis:
1820
mkdir -p $@
19-
wget -qO- https://download.redis.io/releases/redis-6.2.5.tar.gz | tar xvz --strip-components=1 -C $@
21+
wget -qO- https://download.redis.io/releases/redis-7.0.7.tar.gz | tar xvz --strip-components=1 -C $@
2022

2123
testdata/redis/src/redis-server: testdata/redis
2224
cd $< && make all
@@ -26,10 +28,9 @@ fmt:
2628
goimports -w -local github.com/go-redis/redis ./
2729

2830
go_mod_tidy:
29-
go get -u && go mod tidy
3031
set -e; for dir in $(PACKAGE_DIRS); do \
3132
echo "go mod tidy in $${dir}"; \
3233
(cd "$${dir}" && \
33-
go get -u && \
34-
go mod tidy); \
34+
go get -u ./... && \
35+
go mod tidy -compat=1.17); \
3536
done

0 commit comments

Comments
 (0)