Skip to content

Commit 36f9f58

Browse files
authored
Merge branch 'master' into ndyakov/CAE-1088-resp3-notification-handlers
2 parents 422779b + ff4d63e commit 36f9f58

17 files changed

+135
-40
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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
go-version: ${{ matrix.go-version }}
3333

3434
- name: Checkout code
35-
uses: actions/checkout@v4
35+
uses: actions/checkout@v5
3636

3737
- name: Setup Test environment
3838
env:
@@ -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
)
@@ -84,7 +84,7 @@ jobs:
8484

8585
steps:
8686
- name: Checkout code
87-
uses: actions/checkout@v4
87+
uses: actions/checkout@v5
8888

8989
- name: Run tests
9090
uses: ./.github/actions/run-tests

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535

3636
steps:
3737
- name: Checkout repository
38-
uses: actions/checkout@v4
38+
uses: actions/checkout@v5
3939

4040
# Initializes the CodeQL tools for scanning.
4141
- name: Initialize CodeQL

.github/workflows/doctests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
go-version: ${{ matrix.go-version }}
3737

3838
- name: Checkout code
39-
uses: actions/checkout@v4
39+
uses: actions/checkout@v5
4040

4141
- name: Test doc examples
4242
working-directory: ./doctests

.github/workflows/golangci-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
name: lint
2121
runs-on: ubuntu-latest
2222
steps:
23-
- uses: actions/checkout@v4
23+
- uses: actions/checkout@v5
2424
- name: golangci-lint
2525
uses: golangci/[email protected]
2626
with:

.github/workflows/spellcheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
runs-on: ubuntu-latest
77
steps:
88
- name: Checkout
9-
uses: actions/checkout@v4
9+
uses: actions/checkout@v5
1010
- name: Check Spelling
1111
uses: rojopolis/[email protected]
1212
with:

.github/workflows/test-redis-enterprise.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020

2121
steps:
2222
- name: Checkout code
23-
uses: actions/checkout@v4
23+
uses: actions/checkout@v5
2424

2525
- name: Clone Redis EE docker repository
26-
uses: actions/checkout@v4
26+
uses: actions/checkout@v5
2727
with:
2828
repository: RedisLabs/redis-ee-docker
2929
path: redis-ee

README.md

Lines changed: 2 additions & 2 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

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() {

internal/pool/buffer_size_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ var _ = Describe("Buffer Size Configuration", func() {
3434
Expect(err).NotTo(HaveOccurred())
3535
defer connPool.CloseConn(cn)
3636

37-
// Check that default buffer sizes are used (256KiB)
37+
// Check that default buffer sizes are used (32KiB)
3838
writerBufSize := getWriterBufSizeUnsafe(cn)
3939
readerBufSize := getReaderBufSizeUnsafe(cn)
4040

41-
Expect(writerBufSize).To(Equal(proto.DefaultBufferSize)) // Default 256KiB buffer size
42-
Expect(readerBufSize).To(Equal(proto.DefaultBufferSize)) // Default 256KiB buffer size
41+
Expect(writerBufSize).To(Equal(proto.DefaultBufferSize)) // Default 32KiB buffer size
42+
Expect(readerBufSize).To(Equal(proto.DefaultBufferSize)) // Default 32KiB buffer size
4343
})
4444

4545
It("should use custom buffer sizes when specified", func() {
@@ -79,28 +79,28 @@ var _ = Describe("Buffer Size Configuration", func() {
7979
Expect(err).NotTo(HaveOccurred())
8080
defer connPool.CloseConn(cn)
8181

82-
// Check that default buffer sizes are used (256KiB)
82+
// Check that default buffer sizes are used (32KiB)
8383
writerBufSize := getWriterBufSizeUnsafe(cn)
8484
readerBufSize := getReaderBufSizeUnsafe(cn)
8585

86-
Expect(writerBufSize).To(Equal(proto.DefaultBufferSize)) // Default 256KiB buffer size
87-
Expect(readerBufSize).To(Equal(proto.DefaultBufferSize)) // Default 256KiB buffer size
86+
Expect(writerBufSize).To(Equal(proto.DefaultBufferSize)) // Default 32KiB buffer size
87+
Expect(readerBufSize).To(Equal(proto.DefaultBufferSize)) // Default 32KiB buffer size
8888
})
8989

90-
It("should use 256KiB default buffer sizes for standalone NewConn", func() {
91-
// Test that NewConn (without pool) also uses 256KiB buffers
90+
It("should use 32KiB default buffer sizes for standalone NewConn", func() {
91+
// Test that NewConn (without pool) also uses 32KiB buffers
9292
netConn := newDummyConn()
9393
cn := pool.NewConn(netConn)
9494
defer cn.Close()
9595

9696
writerBufSize := getWriterBufSizeUnsafe(cn)
9797
readerBufSize := getReaderBufSizeUnsafe(cn)
9898

99-
Expect(writerBufSize).To(Equal(proto.DefaultBufferSize)) // Default 256KiB buffer size
100-
Expect(readerBufSize).To(Equal(proto.DefaultBufferSize)) // Default 256KiB buffer size
99+
Expect(writerBufSize).To(Equal(proto.DefaultBufferSize)) // Default 32KiB buffer size
100+
Expect(readerBufSize).To(Equal(proto.DefaultBufferSize)) // Default 32KiB buffer size
101101
})
102102

103-
It("should use 256KiB defaults even when pool is created directly without buffer sizes", func() {
103+
It("should use 32KiB defaults even when pool is created directly without buffer sizes", func() {
104104
// Test the scenario where someone creates a pool directly (like in tests)
105105
// without setting ReadBufferSize and WriteBufferSize
106106
connPool = pool.NewConnPool(&pool.Options{
@@ -114,12 +114,12 @@ var _ = Describe("Buffer Size Configuration", func() {
114114
Expect(err).NotTo(HaveOccurred())
115115
defer connPool.CloseConn(cn)
116116

117-
// Should still get 256KiB defaults because NewConnPool sets them
117+
// Should still get 32KiB defaults because NewConnPool sets them
118118
writerBufSize := getWriterBufSizeUnsafe(cn)
119119
readerBufSize := getReaderBufSizeUnsafe(cn)
120120

121-
Expect(writerBufSize).To(Equal(proto.DefaultBufferSize)) // Default 256KiB buffer size
122-
Expect(readerBufSize).To(Equal(proto.DefaultBufferSize)) // Default 256KiB buffer size
121+
Expect(writerBufSize).To(Equal(proto.DefaultBufferSize)) // Default 32KiB buffer size
122+
Expect(readerBufSize).To(Equal(proto.DefaultBufferSize)) // Default 32KiB buffer size
123123
})
124124
})
125125

0 commit comments

Comments
 (0)