Skip to content

Commit 6b3c6f8

Browse files
authored
Merge branch 'redis:master' into feat/improve_success_rate_of_new_connections
2 parents d07d3bc + 52bda7a commit 6b3c6f8

File tree

36 files changed

+513
-94
lines changed

36 files changed

+513
-94
lines changed

.github/actions/run-tests/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ runs:
2525
2626
# Mapping of redis version to redis testing containers
2727
declare -A redis_version_mapping=(
28-
["8.2.x"]="8.2"
28+
["8.2.x"]="8.2.1-pre"
2929
["8.0.x"]="8.0.2"
3030
["7.4.x"]="rs-7.4.0-v5"
3131
["7.2.x"]="rs-7.2.0-v17"

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
4545
# Mapping of redis version to redis testing containers
4646
declare -A redis_version_mapping=(
47-
["8.2.x"]="8.2"
47+
["8.2.x"]="8.2.1-pre"
4848
["8.0.x"]="8.0.2"
4949
["7.4.x"]="rs-7.4.0-v5"
5050
)

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Here's how to get started with your code contribution:
3737
> Note: this clones and builds the docker containers specified in `docker-compose.yml`, to understand more about
3838
> the infrastructure that will be started you can check the `docker-compose.yml`. You also have the possiblity
3939
> to specify the redis image that will be pulled with the env variable `CLIENT_LIBS_TEST_IMAGE`.
40-
> By default the docker image that will be pulled and started is `redislabs/client-libs-test:rs-7.4.0-v2`.
40+
> By default the docker image that will be pulled and started is `redislabs/client-libs-test:8.2.1-pre`.
4141
> If you want to test with newer Redis version, using a newer version of `redislabs/client-libs-test` should work out of the box.
4242
4343
4. While developing, make sure the tests pass by running `make test` (if you have the docker containers running, `make test.ci` may be sufficient).

Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort)
2+
REDIS_VERSION ?= 8.2
3+
RE_CLUSTER ?= false
4+
RCE_DOCKER ?= true
5+
CLIENT_LIBS_TEST_IMAGE ?= redislabs/client-libs-test:8.2.1-pre
26

37
docker.start:
8+
export RE_CLUSTER=$(RE_CLUSTER) && \
9+
export RCE_DOCKER=$(RCE_DOCKER) && \
10+
export REDIS_VERSION=$(REDIS_VERSION) && \
11+
export CLIENT_LIBS_TEST_IMAGE=$(CLIENT_LIBS_TEST_IMAGE) && \
412
docker compose --profile all up -d --quiet-pull
513

614
docker.stop:
@@ -27,6 +35,9 @@ test.ci:
2735
set -e; for dir in $(GO_MOD_DIRS); do \
2836
echo "go test in $${dir}"; \
2937
(cd "$${dir}" && \
38+
export RE_CLUSTER=$(RE_CLUSTER) && \
39+
export RCE_DOCKER=$(RCE_DOCKER) && \
40+
export REDIS_VERSION=$(REDIS_VERSION) && \
3041
go mod tidy -compat=1.18 && \
3142
go vet && \
3243
go test -v -coverprofile=coverage.txt -covermode=atomic ./... -race -skip Example); \
@@ -38,6 +49,9 @@ test.ci.skip-vectorsets:
3849
set -e; for dir in $(GO_MOD_DIRS); do \
3950
echo "go test in $${dir} (skipping vector sets)"; \
4051
(cd "$${dir}" && \
52+
export RE_CLUSTER=$(RE_CLUSTER) && \
53+
export RCE_DOCKER=$(RCE_DOCKER) && \
54+
export REDIS_VERSION=$(REDIS_VERSION) && \
4155
go mod tidy -compat=1.18 && \
4256
go vet && \
4357
go test -v -coverprofile=coverage.txt -covermode=atomic ./... -race \
@@ -47,11 +61,17 @@ test.ci.skip-vectorsets:
4761
go vet -vettool ./internal/customvet/customvet
4862

4963
bench:
64+
export RE_CLUSTER=$(RE_CLUSTER) && \
65+
export RCE_DOCKER=$(RCE_DOCKER) && \
66+
export REDIS_VERSION=$(REDIS_VERSION) && \
5067
go test ./... -test.run=NONE -test.bench=. -test.benchmem -skip Example
5168

5269
.PHONY: all test test.ci test.ci.skip-vectorsets bench fmt
5370

5471
build:
72+
export RE_CLUSTER=$(RE_CLUSTER) && \
73+
export RCE_DOCKER=$(RCE_DOCKER) && \
74+
export REDIS_VERSION=$(REDIS_VERSION) && \
5575
go build .
5676

5777
fmt:

README.md

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ func main() {
301301
302302
### Buffer Size Configuration
303303
304-
go-redis uses 0.5MiB read and write buffers by default for optimal performance. For high-throughput applications or large pipelines, you can customize buffer sizes:
304+
go-redis uses 32KiB read and write buffers by default for optimal performance. For high-throughput applications or large pipelines, you can customize buffer sizes:
305305
306306
```go
307307
rdb := redis.NewClient(&redis.Options{
@@ -376,7 +376,7 @@ You can find further details in the [query dialect documentation](https://redis.
376376
377377
#### Custom buffer sizes
378378
Prior to v9.12, the buffer size was the default go value of 4096 bytes. Starting from v9.12,
379-
go-redis uses 256KiB read and write buffers by default for optimal performance.
379+
go-redis uses 32KiB read and write buffers by default for optimal performance.
380380
For high-throughput applications or large pipelines, you can customize buffer sizes:
381381
382382
```go
@@ -432,36 +432,9 @@ res, err := rdb.Do(ctx, "set", "key", "value").Result()
432432
433433
## Run the test
434434
435-
go-redis will start a redis-server and run the test cases.
436-
437-
The paths of redis-server bin file and redis config file are defined in `main_test.go`:
438-
439-
```go
440-
var (
441-
redisServerBin, _ = filepath.Abs(filepath.Join("testdata", "redis", "src", "redis-server"))
442-
redisServerConf, _ = filepath.Abs(filepath.Join("testdata", "redis", "redis.conf"))
443-
)
444-
```
445-
446-
For local testing, you can change the variables to refer to your local files, or create a soft link
447-
to the corresponding folder for redis-server and copy the config file to `testdata/redis/`:
448-
449-
```shell
450-
ln -s /usr/bin/redis-server ./go-redis/testdata/redis/src
451-
cp ./go-redis/testdata/redis.conf ./go-redis/testdata/redis/
452-
```
453-
454-
Lastly, run:
455-
456-
```shell
457-
go test
458-
```
459-
460-
Another option is to run your specific tests with an already running redis. The example below, tests
461-
against a redis running on port 9999.:
462-
435+
Recommended to use Docker, just need to run:
463436
```shell
464-
REDIS_PORT=9999 go test <your options>
437+
make test
465438
```
466439
467440
## See also

RELEASE-NOTES.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,49 @@
11
# Release Notes
22

3+
# 9.13.0 (2025-09-03)
4+
5+
## Highlights
6+
- Pipeliner expose queued commands ([#3496](https://github.com/redis/go-redis/pull/3496))
7+
- Ensure that JSON.GET returns Nil response ([#3470](https://github.com/redis/go-redis/pull/3470))
8+
- Fixes on Read and Write buffer sizes and UniversalOptions
9+
10+
## Changes
11+
- Pipeliner expose queued commands ([#3496](https://github.com/redis/go-redis/pull/3496))
12+
- fix(test): fix a timing issue in pubsub test ([#3498](https://github.com/redis/go-redis/pull/3498))
13+
- Allow users to enable read-write splitting in failover mode. ([#3482](https://github.com/redis/go-redis/pull/3482))
14+
- Set the read/write buffer size of the sentinel client to 4KiB ([#3476](https://github.com/redis/go-redis/pull/3476))
15+
16+
## 🚀 New Features
17+
18+
- fix(otel): register wait metrics ([#3499](https://github.com/redis/go-redis/pull/3499))
19+
- Support subscriptions against cluster slave nodes ([#3480](https://github.com/redis/go-redis/pull/3480))
20+
- Add wait metrics to otel ([#3493](https://github.com/redis/go-redis/pull/3493))
21+
- Clean failing timeout implementation ([#3472](https://github.com/redis/go-redis/pull/3472))
22+
23+
## 🐛 Bug Fixes
24+
25+
- Do not assume that all non-IP hosts are loopbacks ([#3085](https://github.com/redis/go-redis/pull/3085))
26+
- Ensure that JSON.GET returns Nil response ([#3470](https://github.com/redis/go-redis/pull/3470))
27+
28+
## 🧰 Maintenance
29+
30+
- fix(otel): register wait metrics ([#3499](https://github.com/redis/go-redis/pull/3499))
31+
- fix(make test): Add default env in makefile ([#3491](https://github.com/redis/go-redis/pull/3491))
32+
- Update the introduction to running tests in README.md ([#3495](https://github.com/redis/go-redis/pull/3495))
33+
- test: Add comprehensive edge case tests for IncrByFloat command ([#3477](https://github.com/redis/go-redis/pull/3477))
34+
- Set the default read/write buffer size of Redis connection to 32KiB ([#3483](https://github.com/redis/go-redis/pull/3483))
35+
- Bumps test image to 8.2.1-pre ([#3478](https://github.com/redis/go-redis/pull/3478))
36+
- fix UniversalOptions miss ReadBufferSize and WriteBufferSize options ([#3485](https://github.com/redis/go-redis/pull/3485))
37+
- chore(deps): bump actions/checkout from 4 to 5 ([#3484](https://github.com/redis/go-redis/pull/3484))
38+
- Removes dry run for stale issues policy ([#3471](https://github.com/redis/go-redis/pull/3471))
39+
- Update otel metrics URL ([#3474](https://github.com/redis/go-redis/pull/3474))
40+
41+
## Contributors
42+
We'd like to thank all the contributors who worked on this release!
43+
44+
[@LINKIWI](https://github.com/LINKIWI), [@cxljs](https://github.com/cxljs), [@cybersmeashish](https://github.com/cybersmeashish), [@elena-kolevska](https://github.com/elena-kolevska), [@htemelski-redis](https://github.com/htemelski-redis), [@mwhooker](https://github.com/mwhooker), [@ndyakov](https://github.com/ndyakov), [@ofekshenawa](https://github.com/ofekshenawa), [@suever](https://github.com/suever)
45+
46+
347
# 9.12.1 (2025-08-11)
448
## 🚀 Highlights
549
In the last version (9.12.0) the client introduced bigger write and read buffer sized. The default value we set was 512KiB.

commands.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ var (
253253
_ Cmdable = (*Tx)(nil)
254254
_ Cmdable = (*Ring)(nil)
255255
_ Cmdable = (*ClusterClient)(nil)
256+
_ Cmdable = (*Pipeline)(nil)
256257
)
257258

258259
type cmdable func(ctx context.Context, cmd Cmder) error

commands_test.go

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2412,6 +2412,77 @@ var _ = Describe("Commands", func() {
24122412

24132413
Expect(args).To(Equal(expectedArgs))
24142414
})
2415+
2416+
It("should IncrByFloat with edge cases", func() {
2417+
// Test with negative increment
2418+
set := client.Set(ctx, "key", "10.5", 0)
2419+
Expect(set.Err()).NotTo(HaveOccurred())
2420+
2421+
incrByFloat := client.IncrByFloat(ctx, "key", -2.3)
2422+
Expect(incrByFloat.Err()).NotTo(HaveOccurred())
2423+
Expect(incrByFloat.Val()).To(BeNumerically("~", 8.2, 0.0001))
2424+
2425+
// Test with zero increment (should return current value)
2426+
incrByFloat = client.IncrByFloat(ctx, "key", 0.0)
2427+
Expect(incrByFloat.Err()).NotTo(HaveOccurred())
2428+
Expect(incrByFloat.Val()).To(BeNumerically("~", 8.2, 0.0001))
2429+
2430+
// Test with very small increment (precision test)
2431+
incrByFloat = client.IncrByFloat(ctx, "key", 0.0001)
2432+
Expect(incrByFloat.Err()).NotTo(HaveOccurred())
2433+
Expect(incrByFloat.Val()).To(BeNumerically("~", 8.2001, 0.00001))
2434+
2435+
// Test with non-existent key (should start from 0)
2436+
incrByFloat = client.IncrByFloat(ctx, "nonexistent", 5.5)
2437+
Expect(incrByFloat.Err()).NotTo(HaveOccurred())
2438+
Expect(incrByFloat.Val()).To(Equal(5.5))
2439+
2440+
// Test with integer value stored as string
2441+
set = client.Set(ctx, "intkey", "42", 0)
2442+
Expect(set.Err()).NotTo(HaveOccurred())
2443+
2444+
incrByFloat = client.IncrByFloat(ctx, "intkey", 0.5)
2445+
Expect(incrByFloat.Err()).NotTo(HaveOccurred())
2446+
Expect(incrByFloat.Val()).To(Equal(42.5))
2447+
2448+
// Test with scientific notation
2449+
set = client.Set(ctx, "scikey", "1.5e2", 0)
2450+
Expect(set.Err()).NotTo(HaveOccurred())
2451+
2452+
incrByFloat = client.IncrByFloat(ctx, "scikey", 5.0)
2453+
Expect(incrByFloat.Err()).NotTo(HaveOccurred())
2454+
Expect(incrByFloat.Val()).To(Equal(155.0))
2455+
2456+
// Test with negative scientific notation
2457+
incrByFloat = client.IncrByFloat(ctx, "scikey", -1.5e1)
2458+
Expect(incrByFloat.Err()).NotTo(HaveOccurred())
2459+
Expect(incrByFloat.Val()).To(Equal(140.0))
2460+
2461+
// Test error case: non-numeric value
2462+
set = client.Set(ctx, "stringkey", "notanumber", 0)
2463+
Expect(set.Err()).NotTo(HaveOccurred())
2464+
2465+
incrByFloat = client.IncrByFloat(ctx, "stringkey", 1.0)
2466+
Expect(incrByFloat.Err()).To(HaveOccurred())
2467+
Expect(incrByFloat.Err().Error()).To(ContainSubstring("value is not a valid float"))
2468+
2469+
// Test with very large numbers
2470+
set = client.Set(ctx, "largekey", "1.7976931348623157e+308", 0)
2471+
Expect(set.Err()).NotTo(HaveOccurred())
2472+
2473+
// This should work as it's within float64 range
2474+
incrByFloat = client.IncrByFloat(ctx, "largekey", -1.0e+308)
2475+
Expect(incrByFloat.Err()).NotTo(HaveOccurred())
2476+
Expect(incrByFloat.Val()).To(BeNumerically("~", 7.976931348623157e+307, 1e+300))
2477+
2478+
// Test with very small numbers (near zero)
2479+
set = client.Set(ctx, "smallkey", "1e-10", 0)
2480+
Expect(set.Err()).NotTo(HaveOccurred())
2481+
2482+
incrByFloat = client.IncrByFloat(ctx, "smallkey", 1e-10)
2483+
Expect(incrByFloat.Err()).NotTo(HaveOccurred())
2484+
Expect(incrByFloat.Val()).To(BeNumerically("~", 2e-10, 1e-15))
2485+
})
24152486
})
24162487

24172488
Describe("hashes", func() {

docker-compose.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
services:
44
redis:
5-
image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:rs-7.4.0-v2}
5+
image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:8.2.1-pre}
66
platform: linux/amd64
77
container_name: redis-standalone
88
environment:
@@ -23,7 +23,7 @@ services:
2323
- all
2424

2525
osscluster:
26-
image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:rs-7.4.0-v2}
26+
image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:8.2.1-pre}
2727
platform: linux/amd64
2828
container_name: redis-osscluster
2929
environment:
@@ -40,7 +40,7 @@ services:
4040
- all
4141

4242
sentinel-cluster:
43-
image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:rs-7.4.0-v2}
43+
image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:8.2.1-pre}
4444
platform: linux/amd64
4545
container_name: redis-sentinel-cluster
4646
network_mode: "host"
@@ -60,7 +60,7 @@ services:
6060
- all
6161

6262
sentinel:
63-
image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:rs-7.4.0-v2}
63+
image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:8.2.1-pre}
6464
platform: linux/amd64
6565
container_name: redis-sentinel
6666
depends_on:
@@ -84,7 +84,7 @@ services:
8484
- all
8585

8686
ring-cluster:
87-
image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:rs-7.4.0-v2}
87+
image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:8.2.1-pre}
8888
platform: linux/amd64
8989
container_name: redis-ring-cluster
9090
environment:

example/del-keys-without-ttl/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.18
55
replace github.com/redis/go-redis/v9 => ../..
66

77
require (
8-
github.com/redis/go-redis/v9 v9.12.1
8+
github.com/redis/go-redis/v9 v9.13.0
99
go.uber.org/zap v1.24.0
1010
)
1111

0 commit comments

Comments
 (0)