43 Commits
Author SHA1 Message Date
zeekay 6994cf05aa kv, not redis: rename the package, the extras and the URL scheme
We do not use Redis. The client was a go-redis fork and still said so
everywhere: `package redis`, `redis.NewClient`, `redis://`, `extra/redisotel`.
Consumers wrote `redis.Client` against a Valkey-backed store called KV.

  package redis            -> package kv          (93 decls)
  redis.X                  -> kv.X                (2,794 call sites)
  "redis: …" errors        -> "kv: …"             (206)
  extra/redis{otel,cmd,prometheus,census} -> extra/kv{otel,cmd,prometheus,census}
  redis:// , rediss://     -> kv:// , kvs://      (ParseURL)
  Redis*/‌*Redis* idents    -> KV*/*KV*
  REDIS_VERSION, REDIS_ENDPOINTS_CONFIG_PATH -> KV_*

I previously argued this rename was unsafe because much of it was "wire
contract". That was wrong, and the categorisation shows why: RESP command names
are GET/SET/HSET — they never contain the word. Of 5,771 occurrences only two
kinds were server-visible at all: the ParseURL scheme (we choose what we pass;
our configs already use kv://) and the CLIENT SETINFO lib-name label, which the
server merely records. Nothing here changes a byte of protocol.

Two things deliberately keep the old spelling:
  RediSearch  — names a specific external module the FT.* commands map to.
  StoreDist   — contains the letters by accident (sto-reDis-t), not the word.

Breaking for consumers by design: every import site must move redis.X -> kv.X.
Minor bump, never a major — this module stays v9 forever.
2026-07-26 08:34:19 -07:00
zeekay 2016e30150 module path: github.com/hanzoai/kv-go -> github.com/hanzokv/go
KV lives in its own org now, like hanzokms / hanzos3 / hanzo-ds. The repo moved
hanzoai/kv-go -> hanzokv/go, so the module path follows: a Go module path must
match where the repo actually is, or the proxy cannot resolve it.

The name is `go`, not `kv-go`, following the hanzo-ds convention — that org
holds go, mock, native, sqlbuilder, sqlparser, each named for its language or
concern with the ORG supplying the product noun. Repeating "kv" inside a repo
that already lives under hanzokv is the compound-word habit we are dropping.

349 occurrences across 188 files: the root module, all four extra/* modules,
every example module, imports throughout the tree, and the docs. Builds clean.

The package is still `package redis` and the extra dirs are still named
redis*. That rename is deliberately NOT bundled here: it is 5,771 occurrences,
it breaks all 11 consumers at once, and a large share are WIRE CONTRACTS rather
than branding — the redis:// scheme parser, the "redis: nil" error string, RESP
command names. Renaming those breaks protocol compatibility with the Valkey
server. It needs the same our-vocabulary-vs-the-wire split the argo sweep used,
as its own change.

GitHub keeps the old path redirecting, and versions already published under
github.com/hanzoai/kv-go/v9 stay resolvable, so nothing breaks the moment this
lands. Consumers move on their own schedule.
2026-07-25 23:43:06 -07:00
zeekay 24f201b8e5 Rebrand as hanzoai/kv-go
Update module path from github.com/redis/go-redis/v9 to
github.com/hanzoai/kv-go/v9 for use as the Hanzo KV Go SDK.

- Update go.mod module declaration
- Update all Go imports across 260 files
- Update all submodule go.mod files (extra/*, example/*, internal/customvet)
2026-01-19 18:15:43 -08:00
ofekshenawaandGitHub 4edf494293 fix(retry): Add retry mechanism for NOREPLICAS error (#3647) 2025-12-10 18:14:05 +02:00
6c24f600de feat(errors): Introduce typed errors (#3602)
* typed errors

* add error documentation

* backwards compatibility

* update readme, remove Is methods

* Update internal/proto/redis_errors.go

Co-authored-by: Copilot <[email protected]>

* Update internal/proto/redis_errors.go

Co-authored-by: Copilot <[email protected]>

* support error wrapping for io and context errors

* use unwrapping of errors in push for consistency

* add common error types

* fix test

* fix flaky test

* add comments in the example

---------

Co-authored-by: Copilot <[email protected]>
2025-11-19 17:31:54 +02:00
a15e76394c fix(pool): Pool ReAuth should not interfere with handoff (#3547)
* fix(pool): wip, pool reauth should not interfere with handoff

* fix credListeners map

* fix race in tests

* better conn usable timeout

* add design decision comment

* few small improvements

* update marked as queued

* add Used to clarify the state of the conn

* rename test

* fix(test): fix flaky test

* lock inside the listeners collection

* address pr comments

* Update internal/auth/cred_listeners.go

Co-authored-by: Copilot <[email protected]>

* Update internal/pool/buffer_size_test.go

Co-authored-by: Copilot <[email protected]>

* wip refactor entraid

* fix maintnotif pool hook

* fix mocks

* fix nil listener

* sync and async reauth based on conn lifecycle

* be able to reject connection OnGet

* pass hooks so the tests can observe reauth

* give some time for the background to execute commands

* fix tests

* only async reauth

* Update internal/pool/pool.go

Co-authored-by: Copilot <[email protected]>

* Update internal/auth/streaming/pool_hook.go

Co-authored-by: Copilot <[email protected]>

* Update internal/pool/conn.go

Co-authored-by: Copilot <[email protected]>

* chore(redisotel): use metric.WithAttributeSet to avoid copy (#3552)

In order to improve performance replace `WithAttributes` with `WithAttributeSet`.
This avoids the slice allocation and copy that is done in `WithAttributes`.

For more information see https://github.com/open-telemetry/opentelemetry-go/blob/v1.38.0/metric/instrument.go#L357-L376

* chore(docs): explain why MaxRetries is disabled for ClusterClient (#3551)

Co-authored-by: Nedyalko Dyakov <[email protected]>

* exponential backoff

* address pr comments

* address pr comments

* remove rlock

* add some comments

* add comments

---------

Co-authored-by: Copilot <[email protected]>
Co-authored-by: Warnar Boekkooi <[email protected]>
Co-authored-by: Justin <[email protected]>
2025-10-22 12:45:30 +03:00
Nedyalko DyakovandGitHub 4c635cc563 fix(txpipeline): should return error on multi/exec on multiple slots [CAE-1028] (#3408)
* fix(txpipeline): should return error on multi/exec on multiple slots

* fix(txpipeline): test normal tx pipeline behaviour

* chore(err): Extract crossslot err and add test

* fix(txpipeline): short curcuit the tx if there are no commands

* chore(tests): validate keys are in different slots
2025-06-18 14:18:00 +03:00
LINKIWIandGitHub ba26e35a2c Export pool errors for public consumption (#3380) 2025-05-19 19:23:10 +03:00
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 <[email protected]>
2025-03-24 15:28:20 +02:00
4f09082f6b fix: connection pool timeout, increase retries (#3298)
* fix: connection pool timeout, increase retries

Signed-off-by: monkey <[email protected]>

* fix: add shouldRetry test

Signed-off-by: monkey <[email protected]>

---------

Signed-off-by: monkey <[email protected]>
Co-authored-by: Nedyalko Dyakov <[email protected]>
2025-03-14 10:05:22 +02:00
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 <[email protected]>
Co-authored-by: Nedyalko Dyakov <[email protected]>
2025-03-05 22:08:27 +02:00
b64d9deef3 Handle IPv6 in isMovedError (#2981)
* Handle IPv6 in isMovedError

* Simplify GetAddr

---------

Co-authored-by: Monkey <[email protected]>
2024-04-28 12:37:44 +08:00
81947daa8d Handle wrapped errors in scripter.Run (#2674)
* Handle wrapped errors in script

* test

* remove accidentially committed changes

---------

Co-authored-by: ofekshenawa <[email protected]>
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 FreixesandGitHub 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 <[email protected]>
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