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

35 Commits

Author SHA1 Message Date
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
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
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
Dávid Baláž
b64d9deef3
Handle IPv6 in isMovedError (#2981)
* Handle IPv6 in isMovedError

* Simplify GetAddr

---------

Co-authored-by: Monkey <golang@88.com>
2024-04-28 12:37:44 +08:00
Sergey Galkin
81947daa8d
Handle wrapped errors in scripter.Run (#2674)
* Handle wrapped errors in script

* test

* remove accidentially committed changes

---------

Co-authored-by: ofekshenawa <104765379+ofekshenawa@users.noreply.github.com>
2023-10-30 18:08:18 +02:00
Vladimir Mihailenco
97b491aace chore: update import path 2023-01-23 08:48:54 +02:00
Vladimir Mihailenco
d3d8002e89 feat: add HasErrorPrefix 2022-11-17 16:18:04 +02:00
Vladimir Mihailenco
a18fad5bd3 chore: v9 2022-06-04 17:42:06 +03:00
Vladimir Mihailenco
1980be0f9f chore: fix golangci-lint 2022-06-04 10:50:58 +03:00
Pau Freixes
96f53a0159 fix: format 2021-10-04 17:22:18 +02:00
Pau Freixes
7f7c181761 fix: add whitespace for avoid unlikely colisions 2021-10-04 15:53:57 +02:00
Pau Freixes
98bb99ddc2
Fix Redis Cluster issue during roll outs of new nodes with same addr (#1914)
* fix: recycle connections in some Redis Cluster scenarios

This issue was surfaced in a Cloud Provider solution that used for
rolling out new nodes using the same address (hostname) of the nodes
that will be replaced in a Redis Cluster, while the former ones once
depromoted as Slaves would continue in service during some mintues
for redirecting traffic.

The solution basically identifies when the connection could be stale
since a MOVED response will be returned using the same address (hostname)
that is being used by the connection. At that moment we consider the
connection as no longer usable forcing to recycle the connection.
2021-10-04 13:10:42 +03:00
monkey
26373ef2f1 follow to golang-lint 1.40
Signed-off-by: monkey <golang@88.com>
2021-05-13 10:33:38 +08:00
Vladimir Mihailenco
02ccf05ed0 Close the conn on context timeout 2020-12-06 11:14:07 +02:00
wziww
e0aa8939c7 TRYAGAIN error should be retry 2020-11-12 17:47:04 +08:00
Vladimir Mihailenco
21a1f58caf Retry timeout and retryable error 2020-07-24 15:52:15 +03:00
Vladimir Mihailenco
4440575966 Merge branch 'v8' 2020-05-21 10:16:44 +03:00
Vladimir Mihailenco
07656a01bf Add redis.Error interface and export ErrClosed
Fixes https://github.com/go-redis/redis/issues/1295
Closes https://github.com/go-redis/redis/pull/1296
2020-05-21 09:24:54 +03:00
Vladimir Mihailenco
3dcb844106 Bump major version 2020-05-19 08:52:38 +03:00
Vladimir Mihailenco
7779accbea Use semantic import versioning 2019-08-08 14:29:44 +03:00
Vladimir Mihailenco
48224a399f Remove releaseConnStrict 2019-08-08 11:44:55 +03:00
Vladimir Mihailenco
2927e15b6b Retry BadConnError 2019-08-08 11:44:55 +03:00
Vladimir Mihailenco
4e9cea8876 Add proper SingleConnPool implementation 2019-08-03 17:31:28 +03:00
Dimitrij Denissenko
7d856c5595 Make proto/parser an internal package 2016-07-02 13:52:10 +01:00
Vladimir Mihailenco
30ce5ebd57 Cleanup error handling code. 2016-03-19 16:33:14 +02:00
Vladimir Mihailenco
46790aa060 Add race test for big vals. Copy connection to avoid race with PubSub. 2016-03-14 16:34:15 +02:00
Vladimir Mihailenco
ad0739be99 Extract pool package. Add pool benchmark. 2016-03-12 10:52:13 +02:00
Vladimir Mihailenco
673e999431 Close connection on network timeout. 2016-03-09 14:36:14 +02:00
Vladimir Mihailenco
110e93a8e4 Simplify connection management with sticky connection pool. Fixes #260. 2016-03-01 14:12:25 +02:00
Vladimir Mihailenco
ade3425870 multi: fix recovering from bad connection. 2015-11-14 14:44:16 +02:00
Vladimir Mihailenco
36fcbb1f94 Update readme for v3. 2015-05-23 14:43:49 +03:00
Vladimir Mihailenco
8c67e00efc Add auto-retry and MaxRetries option. Fixes #84. 2015-05-10 17:02:47 +03:00
Vladimir Mihailenco
99fe9114b1 Add ClusterPipeline. 2015-04-13 09:31:30 +03:00
Vladimir Mihailenco
94a31f499f Attempt to cleanup cluster logic. 2015-04-07 12:51:01 +03:00
Vladimir Mihailenco
deb41df992 Don't remove connection from the pool on redis errors. 2014-06-18 15:55:49 +03:00