1
0
mirror of https://github.com/redis/go-redis.git synced 2025-04-16 09:23:06 +03:00

2617 Commits

Author SHA1 Message Date
Liu Shuang
0cfcd1a61d
update pubsub.go (#3329) 2025-04-03 16:10:31 +03:00
andy-stark-redis
53daf77e1a
DOC-4464 examples for llen, lpop, lpush, lrange, rpop, and rpush (#3234)
* DOC-4464 examples for llen, lpop, lpush, lrange, rpop, and rpush

* DOC-4464 improved variable names

---------

Co-authored-by: Vladyslav Vildanov <117659936+vladvildanov@users.noreply.github.com>
Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
2025-03-28 23:05:36 +02:00
Nedyalko Dyakov
cb3aa19618
Sync master with v9.8.0-beta.1 (#3322) 2025-03-25 12:25:35 +02:00
Nikolay Dubina
482a20d9c9
Feature more prominently how to enable OpenTelemetry instrumentation (#3316) 2025-03-25 09:28:25 +02:00
Oleglacto
132818033b
added Do method for raw query by single conn from pool.Conn() (#3182)
* added `Do` method for raw query by single conn from `pool.Conn()`

* added test to cmdble Do method

* fixed test

* moved Do cmd to commands.go

---------

Co-authored-by: Oleg Laktyushkin <oglaktyushkin@avito.ru>
Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
2025-03-24 18:36:21 +02:00
Nedyalko Dyakov
97f7530415
Drop RedisGears (aka. Triggers and Functions) (#3321) 2025-03-24 17:30:29 +02:00
LINKIWI
9762559c75
Bound connection pool background dials to configured dial timeout (#3089) 2025-03-24 15:45:43 +02:00
Justin
694a7101d4
Make MASTERDOWN a retriable error in RedisCluster client (#3164)
When clusters are running with `replica-server-stale-data no`, replicas
will return a MASTERDOWN error under two conditions:
  1. The primary has failed and we are not serving requests.
  2. A replica has just started and has not yet synced from the primary.

The former, primary has failed and we are not serving requests, is
similar to a CLUSTERDOWN error and should be similarly retriable.

When a replica has just started and has not yet synced from the primary
the request should be retried on other available nodes in the shard.
Otherwise a percentage of the read requests to the shard will fail.

Examples when `replica-server-stale-data no` is enabled:
  1. In a cluster using `ReadOnly` with a single read replica, every
     read request will return errors to the client because MASTERDOWN is
     not a retriable error.
  2. In a cluster using `RouteRandomly` a percentage of the requests
     will return errors to the client based on if this server was
     selected.

Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
2025-03-24 15:28:20 +02:00
Nedyalko Dyakov
30c128a67a
chore: disable verifying golangci configuration (#3319) 2025-03-24 15:19:26 +02:00
Alexander Menshchikov
d86395694d
Add FailoverClusterClient support for Universal client (#2794)
* Add FailoverClusterClient support + fix example/hset-struct go.sum

* Improve NewUniversalClient comment

---------

Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
2025-03-24 14:21:08 +02:00
ofekshenawa
15059395a1
Support new hash commands: HGETDEL, HGETEX, HSETEX (#3305) 2025-03-24 14:03:26 +02:00
dependabot[bot]
d29aace826
chore(deps): bump golangci/golangci-lint-action from 6.5.1 to 6.5.2 (#3317)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6.5.1 to 6.5.2.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v6.5.1...v6.5.2)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-24 13:47:29 +02:00
Nedyalko Dyakov
34222bffeb
release 9.7.3, retract 9.7.2 (#3314) (#3315) 2025-03-21 13:13:14 +02:00
dependabot[bot]
11efd6a01e
chore(deps): bump golang.org/x/net in /example/otel (#3308)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.33.0 to 0.36.0.
- [Commits](https://github.com/golang/net/compare/v0.33.0...v0.36.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-19 21:11:14 +02:00
Nedyalko Dyakov
d236865b0c
fix: handle network error on SETINFO (#3295) (CVE-2025-29923)
* fix: handle network error on SETINFO

This fix addresses potential out of order responses as described in `CVE-2025-29923`

* fix: deprecate DisableIndentity and introduce DisableIdentity

Both options will work before V10. In v10 DisableIndentity will be dropped. The preferred flag to use is `DisableIdentity`.
2025-03-19 19:02:36 +02:00
andy-stark-redis
74d4f08476
DOC-4494 SADD and SMEMBERS command examples (#3242)
* DOC-4494 added sadd example

* DOC-4494 sadd and smembers examples

* DOC-4494 better naming convention for result variables

---------

Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
2025-03-19 17:36:58 +02:00
ofekshenawa
a402c55344
Add vector types INT8 and UINT8 test (#3299) 2025-03-18 18:05:45 +02:00
b1ackd0t
8269e6a22a
fix(tracing): show the whole command rather than truncated version of it (#3290)
Truncate version of a long key might not be useful when debugging

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
2025-03-18 14:50:29 +02:00
Nedyalko Dyakov
9494d8498a
chore: use redis 8 ce m05 (#3304)
* use m05

* add platform, since client-libs has image for amd64

* verbose testing

* Update .github/workflows/build.yml
2025-03-18 14:20:18 +02:00
dependabot[bot]
b3709c6506
chore(deps): bump golangci/golangci-lint-action from 6.5.0 to 6.5.1 (#3302)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6.5.0 to 6.5.1.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v6.5.0...v6.5.1)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-17 16:27:26 +02:00
Monkey
4f09082f6b
fix: connection pool timeout, increase retries (#3298)
* fix: connection pool timeout, increase retries

Signed-off-by: monkey <golang@88.com>

* fix: add shouldRetry test

Signed-off-by: monkey <golang@88.com>

---------

Signed-off-by: monkey <golang@88.com>
Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
2025-03-14 10:05:22 +02:00
LINKIWI
1c9309fdc2
Set client name in HELLO RESP handshake (#3294) 2025-03-13 14:55:28 +02:00
ofekshenawa
555a41ecc7
Enable dialect 2 on default (#3213)
* Enable dialect 2 on deafult

* add vector test for default dialect

* Add dialect 1 test

* Add dialect 1 test & fix ft.search

* Add default dialect to Readme
2025-03-13 14:54:25 +02:00
David Maier
310ce55c59
Update README.md
Minor update on the README by highlighting that go-redis is the official Redis library. The note about Uptrace was moved to the 'contributors' section of the README.
2025-03-12 14:57:19 +01:00
milad
8fadbef84a
add readOnly on failover opts (#3281)
* add readOnly on failover opts

add failover that if is True it connects to slaves

* add test

* add test for slave connect

* fix test

* fix tests

* skip Flaky

* add more tests on slave

* add test

* delete file

* Update universal_test.go

enable previously skipped test.

* rm skip from sentinels

* rm tmp files

* Update universal_test.go

don't run sentinel test in RE

* Update universal_test.go

---------

Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
2025-03-06 16:53:14 +02:00
Bhargav Dodla
162a15432b
fix: Fixed issue with context cancelled error leading to connection spikes on Primary instances (#3190)
* fix: Fixed issue with context cancelled error leading to connection spikes on Master

* fix: Added tests

* fix: Updated tests

---------

Co-authored-by: Bhargav Dodla <bdodla@expediagroup.com>
Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
2025-03-05 22:08:27 +02:00
Nedyalko Dyakov
8e4a2ee5c5
fix(test): sort results in example test (#3292) 2025-03-04 14:28:08 +02:00
fengyun.rui
cd55713972
feat: add hstrlen command for hash (#2843)
* feat: add hstrlen command for hash

Signed-off-by: rfyiamcool <rfyiamcool@163.com>

* feat: add hstrlen command for hash

Signed-off-by: rfyiamcool <rfyiamcool@163.com>

---------

Signed-off-by: rfyiamcool <rfyiamcool@163.com>
Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
2025-03-04 13:31:45 +02:00
Nedyalko Dyakov
ebe11d06ca
feat: Enable CI for Redis CE 8.0 (#3274)
* chore: extract benchmark tests

* wip

* enable pubsub tests

* enable ring tests

* stop tests with build redis from source

* start all tests

* mix of makefile and action

* add sentinel configs

* fix example test

* stop debug on re

* wip

* enable gears for redis 7.2

* wip

* enable sentinel, they are expected to fail

* fix: linter configuration

* chore: update re versions

* return older redis enterprise version

* add basic codeql

* wip: increase timeout, focus only sentinel tests

* sentinels with docker network host

* enable all tests

* fix flanky test

* enable example tests

* tidy docker compose

* add debug output

* stop shutingdown masters

* don't test sentinel for re

* skip unsuported addscores

* Update README

bump go version in CI

* Update README.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update CONTRIBUTING.md

add information about new test setup

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-02-28 12:49:00 +02:00
Flc゛
5314a57132
fix(redisotel): fix the situation of reporting spans multiple times (#3168)
Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
2025-02-27 17:14:46 +02:00
Rushikesh Joshi
7d55118554
feat: support Elasticache cluster mode by introducing IsClusterMode config param (#3255)
Co-authored-by: Rushikesh Joshi <rushikesh.joshi@sap.com>
Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
2025-02-26 18:25:55 +02:00
Tom Bayes
d4e74b125d
Add test codes for search_commands.go (#3285)
* feat: add test codes for search_commands.go

* feat: move ftaggregate tests to search_test.go

* Update search_test.go

Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>

* feat: remove reflect from test

* Update search_test.go

fix type in Sprintf

---------

Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
2025-02-26 17:39:45 +02:00
Nedyalko Dyakov
aa7019d718
V9.7.1 -> master (#3287) 2025-02-24 12:45:08 +02:00
fengyun.rui
30e7388c88
fix: race slice for list function of ring client (#2931)
* fix: race slice for list of ring client

Signed-off-by: rfyiamcool <rfyiamcool@163.com>

* fix: copy wrong list

Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>

---------

Signed-off-by: rfyiamcool <rfyiamcool@163.com>
Co-authored-by: ofekshenawa <104765379+ofekshenawa@users.noreply.github.com>
Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
2025-02-20 16:55:54 +02:00
Ali Error
37accb4b28
fix: nil pointer dereferencing in writeArg (#3271)
* fixed bug with nil dereferencing in writeArg, added hset struct example, added tests

* removed password from example

* added omitempty

* reverted xxhash versioning

* reverted xxhash versioning

* removed password

* removed password

---------

Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
2025-02-20 16:54:11 +02:00
andy-stark-redis
747190e231
DOC-4329 added range query examples (#3252)
Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
2025-02-20 16:23:05 +02:00
alingse
f3c2711fe1
move regexp.MustCompile close to call (#3280)
* move regexp.MustCompile out of func

* move moduleRe close to call

---------

Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
2025-02-20 16:22:34 +02:00
herodot
7e517ec4a1
fix(search&aggregate):fix error overwrite and typo #3220 (#3224)
* fix (#3220)

* LOAD has NO AS param(https://redis.io/docs/latest/commands/ft.aggregate/)

* fix typo: WITHCOUT -> WITHCOUNT

* fix (#3220):

    * Compatible with known RediSearch issue in test

* fix (#3220)

    * fixed the calculation bug of the count of load params

* test should not include special condition

* return errors when they occur

---------

Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
Co-authored-by: ofekshenawa <104765379+ofekshenawa@users.noreply.github.com>
2025-02-20 15:55:49 +02:00
dependabot[bot]
c29d399be6
chore(deps): bump rojopolis/spellcheck-github-actions (#3276)
Bumps [rojopolis/spellcheck-github-actions](https://github.com/rojopolis/spellcheck-github-actions) from 0.46.0 to 0.47.0.
- [Release notes](https://github.com/rojopolis/spellcheck-github-actions/releases)
- [Changelog](https://github.com/rojopolis/spellcheck-github-actions/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rojopolis/spellcheck-github-actions/compare/0.46.0...0.47.0)

---
updated-dependencies:
- dependency-name: rojopolis/spellcheck-github-actions
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
2025-02-18 16:04:03 +02:00
Nedyalko Dyakov
a17250d6bc
fix: linter configuration (#3279) 2025-02-18 13:51:22 +02:00
Nedyalko Dyakov
196fc9b21a
use limit when limitoffset is zero (#3275) 2025-02-14 13:07:39 +02:00
LINKIWI
9db1286414
Reinstate read-only lock on hooks access in dialHook (#3225) 2025-02-11 17:50:31 +02:00
Flc゛
40e049e67a
chore(deps): update github.com/cespare/xxhash/v2 to v2.3.0 (#3265)
* chore(deps): update github.com/cespare/xxhash/v2 to v2.3.0

* chore(deps): update github.com/cespare/xxhash/v2 to v2.3.0
2025-02-10 15:03:50 +02:00
Flc゛
021faad4fa
test(redisotel): rename redisotel_test.go to tracing_test.go and add tracing hook tests (#3270)
Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
2025-02-10 14:55:40 +02:00
Nedyalko Dyakov
acbf4a688f
test: add test for info in RCE 8 (#3269) 2025-02-10 14:55:15 +02:00
andy-stark-redis
71311d8044
DOC-4335 added aggregate query examples (#3259)
* DOC-4335 added aggregate query examples (demonstrating errors)

* DOC-4335 remove incomplete examples

* DOC-4335 added missing examples using latest client updates

---------

Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
2025-02-10 14:22:43 +02:00
Nedyalko Dyakov
7f8b5a8167
fix: flaky ClientKillByFilter test (#3268) 2025-02-07 12:56:16 +02:00
Nedyalko Dyakov
d0f921357d
fix: add unstableresp3 to cluster client (#3266)
* fix: add unstableresp3 to cluster client

* propagate unstableresp3

* proper test that will ignore error, but fail if client panics

* add separate test for clusterclient constructor
2025-02-07 12:09:49 +02:00
Nedyalko Dyakov
27f19ea672
fix(aggregate, search): ft.aggregate bugfixes (#3263)
* fix: rearange args for ft.aggregate

apply should be before any groupby or sortby

* improve test

* wip: add scorer and addscores

* enable all tests

* fix ftsearch with count test

* make linter happy

* Addscores is available in later redisearch releases.

For safety state it is available in redis ce 8

* load an apply seem to break scorer and addscores
2025-02-07 11:29:26 +02:00
dependabot[bot]
84cb9d27f2
chore(deps): bump rojopolis/spellcheck-github-actions (#3227)
Bumps [rojopolis/spellcheck-github-actions](https://github.com/rojopolis/spellcheck-github-actions) from 0.45.0 to 0.46.0.
- [Release notes](https://github.com/rojopolis/spellcheck-github-actions/releases)
- [Changelog](https://github.com/rojopolis/spellcheck-github-actions/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rojopolis/spellcheck-github-actions/compare/0.45.0...0.46.0)

---
updated-dependencies:
- dependency-name: rojopolis/spellcheck-github-actions
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
2025-02-07 11:02:15 +02:00