redis 6.0.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +114 -0
  3. data/README.md +172 -5
  4. data/lib/redis/client.rb +5 -1
  5. data/lib/redis/commands/arrays.rb +358 -0
  6. data/lib/redis/commands/bitmaps.rb +24 -0
  7. data/lib/redis/commands/bless.rb +115 -0
  8. data/lib/redis/commands/cluster.rb +9 -2
  9. data/lib/redis/commands/hashes.rb +250 -7
  10. data/lib/redis/commands/keys.rb +48 -11
  11. data/lib/redis/commands/modules/json.rb +27 -2
  12. data/lib/redis/commands/modules/search/aggregation.rb +2 -1
  13. data/lib/redis/commands/modules/search/field.rb +11 -2
  14. data/lib/redis/commands/modules/search/hybrid.rb +3 -0
  15. data/lib/redis/commands/modules/search/index.rb +2 -1
  16. data/lib/redis/commands/modules/search/miscellaneous.rb +2 -1
  17. data/lib/redis/commands/modules/search/query.rb +2 -2
  18. data/lib/redis/commands/modules/search/schema.rb +4 -0
  19. data/lib/redis/commands/scripting.rb +109 -0
  20. data/lib/redis/commands/server.rb +158 -7
  21. data/lib/redis/commands/sets.rb +270 -0
  22. data/lib/redis/commands/sorted_sets.rb +131 -6
  23. data/lib/redis/commands/streams.rb +284 -33
  24. data/lib/redis/commands/strings.rb +232 -6
  25. data/lib/redis/commands/transactions.rb +6 -1
  26. data/lib/redis/commands/vector_sets.rb +407 -0
  27. data/lib/redis/commands.rb +169 -6
  28. data/lib/redis/distributed.rb +539 -22
  29. data/lib/redis/hash_ring.rb +2 -1
  30. data/lib/redis/keyspace_notifications/channels.rb +121 -0
  31. data/lib/redis/keyspace_notifications/manager.rb +1121 -0
  32. data/lib/redis/keyspace_notifications/notification.rb +95 -0
  33. data/lib/redis/keyspace_notifications/parser.rb +170 -0
  34. data/lib/redis/keyspace_notifications.rb +59 -0
  35. data/lib/redis/pipeline.rb +17 -5
  36. data/lib/redis/ractorize.rb +6 -0
  37. data/lib/redis/subscribe.rb +80 -2
  38. data/lib/redis/version.rb +1 -1
  39. data/lib/redis/xxh3.rb +354 -0
  40. data/lib/redis.rb +29 -8
  41. metadata +16 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10e2b37efa4ce556e0a412006412a027693dc20e5f45df8759d2571dec5008ab
4
- data.tar.gz: 074126dd5ed435ac137b0b946129db11ef16020afd8a65dcbe94b181beaf9198
3
+ metadata.gz: 60795c590a9da34c630e8c79cac2d14c4ef086830e99fe0e1dc5064086043211
4
+ data.tar.gz: d0afae36b8c35d2dbdd9f9e532bf5efd7bad50d51ac1430a76426b31de15f537
5
5
  SHA512:
6
- metadata.gz: d5cc54f6d9f95a0d77c2f824569dc9d09506eabf593c9b9d18483bae897258daf1a1fa8e069b79388ac0f8948d288cfe4af3fcea9d3760a3074bc0c4b55cb2fb
7
- data.tar.gz: a8137ff6826639d927179a78d0017604aa34f592bd9710a777a58db0618a8061eb71aa4ee402fae928b26dc6e43a19c4248181604db17b1a584760a806fedadf
6
+ metadata.gz: cc27fa6d693e8f40f352b0a366469035e577609740d6585e2921876e51392e2f58e85ead7a369a690bd152e40ca0f1fcb613b901c04b1ed91ee2f331981d1bbb
7
+ data.tar.gz: d6d1729aa8e92c42d89b1fedf0d81821a01507772c53719fbd52df34fe1b925011cca39c8c9872762ad6ddb43d5154103e9547174db9dc12ce315fb1dc0b32a2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,117 @@
1
+ # 6.1.0
2
+
3
+ ## New features
4
+
5
+ - Add the `BLESS` key-protection commands (Redis 8.12): `bless_get`, `bless_set`, `bless_clear`,
6
+ `bless_scan` and `bless_scan_each`. On `Redis::Cluster`, `bless_scan` iterates every shard the
7
+ way `scan` does (requires redis-cluster-client 0.17.3). `Redis::Distributed` implements all but
8
+ `bless_scan`, whose cursor cannot span ring nodes; use `bless_scan_each` there. (#1395)
9
+ - Add the set member expiration commands (Redis 8.12): `sexpire`, `spexpire`, `sexpireat`,
10
+ `spexpireat`, `sttl`, `spttl`, `sexpiretime`, `spexpiretime` and `spersist`, with the
11
+ `nx:`/`xx:`/`gt:`/`lt:` condition options, plus `saddex` with `mnx:`/`mxx:` and the
12
+ `ex:`/`px:`/`exat:`/`pxat:`/`keepttl:` expiry options. All are available on
13
+ `Redis::Distributed`. (#1405)
14
+ - Add `zmove`, `bzmove` and `zmovemember` (Redis 8.12). Available on `Redis::Distributed`.
15
+ (#1411)
16
+ - Add `bitrangeintarray` (Redis 8.12). Available on `Redis::Distributed`. (#1409)
17
+ - Add the array commands (Redis 8.8): `arset`, `arget`, `armset`, `armget`, `argetrange`,
18
+ `arlen`, `arcount`, `ardel`, `ardelrange`, `arinsert`, `arseek`, `arnext`, `arlastitems`,
19
+ `arring`, `arscan`, `argrep`, `arop` and `arinfo`. All are available on `Redis::Distributed`.
20
+ (#1371)
21
+ - Add `increx` with `by:`, `lbound:`/`ubound:`/`saturate:` and the
22
+ `ex:`/`px:`/`exat:`/`pxat:`/`persist:`/`enx:` expiry options, and `xnack` (Redis 8.8).
23
+ `increx` is available on `Redis::Distributed`. (#1372)
24
+ - `json_set` now accepts `fpha:` to store a numeric array as a packed floating-point array, and
25
+ the sorted set union/intersection commands accept `aggregate: "count"` (Redis 8.8). (#1373)
26
+ - Add keyspace notification support: channel builders and a binary-safe parser for the classic
27
+ `__keyspace@*`/`__keyevent@*` channels and the Redis 8.8 subkey notification families
28
+ (`Redis::KeyspaceNotifications`), plus a manager (`Redis#keyspace_notifications`) that owns a
29
+ dedicated connection, dispatches typed `Notification` objects to handlers, and automatically
30
+ re-subscribes after connection loss (`on_reconnect` signals the lossy gap). Enabling
31
+ `notify-keyspace-events` on the server remains the operator's responsibility. Not supported by
32
+ `Redis::Distributed`. See specs/keyspace-notifications/user-guide.md. (#1375)
33
+ - Add the hot key tracking commands (Redis 8.6): `hotkeys_start`, `hotkeys_get`, `hotkeys_stop`
34
+ and `hotkeys_reset`. A tracking session is state of a single server, so `Redis::Cluster` and
35
+ `Redis::Distributed` raise `NotImplementedError`, also inside `pipelined`/`multi`; call them
36
+ on a single node instead. See the README "Hot key tracking (HOTKEYS)" section. (#1408)
37
+ - `xadd` now accepts `idmp:` and `idmpauto:` for idempotent production, and add `xcfgset`
38
+ (Redis 8.6). (#1402)
39
+ - `xreadgroup` now accepts `claim:` (Redis 8.4). (#1401)
40
+ - Add compare-and-set and compare-and-delete support (Redis 8.4): `set` accepts `ifeq:`, `ifne:`,
41
+ `ifdeq:` and `ifdne:`, and add `delex` and `digest`. `Redis::XXH3.hexdigest` computes the
42
+ XXH3-64 digest of a value locally in pure Ruby, so `ifdeq:`/`ifdne:` need no `DIGEST` round
43
+ trip. Available on `Redis::Distributed`. See the README "Compare-and-set (CAS/CAD)" section.
44
+ (#1393)
45
+ - Add `xdelex` and `xackdel`; `xadd` and `xtrim` now accept `policy:` (`:keepref`, `:delref` or
46
+ `:acked`); `cluster('slot-stats', ...)` replies are reshaped into `[slot, Hash]` pairs
47
+ (Redis 8.2). (#1391, #1392)
48
+ - Add the vector set commands (Redis 8.0): `vadd`, `vcard`, `vdim`, `vemb`, `vlinks`, `vsim`,
49
+ `vrem`, `vismember`, `vrandmember`, `vrange` (Redis 8.4), `vinfo`, `vsetattr` and `vgetattr`.
50
+ All are available on `Redis::Distributed`. (#1382)
51
+ - Add `hgetdel`, `hgetex` and `hsetex` (Redis 8.0). All are available on `Redis::Distributed`.
52
+ (#1389)
53
+ - Add `hexpireat`, `hpexpireat`, `hexpiretime`, `hpexpiretime` and `hpersist`; `hexpire` and
54
+ `hpexpire` now accept the `nx:`/`xx:`/`gt:`/`lt:` condition options (Redis 7.4). All are
55
+ available on `Redis::Distributed`. (#1374)
56
+ - Add `waitaof` (Redis 7.2). On `Redis::Cluster` it is sent to every primary and each count in
57
+ the reply is the minimum across primaries; `Redis::Cluster.new` now accepts
58
+ `command_routings:` to override the driver's per-command request/response policies. (#1387)
59
+ - Add Redis functions (Redis 7.0): `function`, `fcall` and `fcall_ro`. All are available on
60
+ `Redis::Distributed`. (#1383)
61
+ - Add `sort_ro`, `lcs`, `sintercard` and `zintercard` (Redis 7.0). All are available on
62
+ `Redis::Distributed`. (#1384)
63
+ - `info` now accepts several sections at once, `shutdown` accepts `save:`, `now:`, `force:` and
64
+ `abort:`, `xgroup` accepts `entriesread:`, and add `xsetid` with `entriesadded:` and
65
+ `maxdeletedid:` (Redis 7.0). (#1385)
66
+ - Query Engine vector fields pass every attribute through, so algorithm-specific ones such as
67
+ `compression: "SQ8"` and `training_threshold:` (Redis 8.12) need no special handling. (#1397)
68
+ - Make the constants under `Redis`, such as the reply-reshaping lambdas and
69
+ `Redis::Future::FutureNotReady`, shareable, so that commands and pipelines work in non-main
70
+ Ractors. (#1403)
71
+ - Add `redis/ractorize`, which freezes `Redis::Client::ERROR_MAPPING` and
72
+ `Redis::Cluster::Client::ERROR_MAPPING` so that errors can be translated in non-main Ractors.
73
+ Require it in the main Ractor after anything that adds errors to the mappings. See the README
74
+ "Ractors" section. (#1403)
75
+
76
+ ## Bug fixes
77
+
78
+ - Make `hset` return `0` without calling the server when given an empty hash, instead of raising
79
+ `ERR wrong number of arguments for 'hset' command`. (#1290, #1404)
80
+ - Make `Redis::Distributed#multi` release the watched key once the transaction runs or raises, so
81
+ that commands on keys stored on other nodes no longer raise `CannotDistribute` after a `watch`
82
+ and `multi` sequence. An explicit `#unwatch` or another `#multi` after the transaction still
83
+ works as before. (#1407)
84
+ - Fix a race where calling `unsubscribe`/`punsubscribe` from another thread while the
85
+ subscribed client was concurrently tearing down raised `NoMethodError` instead of
86
+ `Redis::SubscriptionError`. (#1375)
87
+ - With sentinels, errors raised by `pipelined` and `multi` are now translated to `Redis::*`
88
+ errors instead of surfacing as `RedisClient::*` errors. (#1396)
89
+ - `zrank` and `zrevrank` with `with_score: true` return `nil` for a missing key or member
90
+ instead of `[nil, nil]`, and RESP2 `nan` replies become `Float::NAN` (Redis 7.2). (#1388)
91
+ - `xautoclaim` replies now include a `'deleted'` key with the ids that were deleted from the
92
+ stream and dropped from the PEL (Redis 7.0; always `[]` on 6.2). (#1386)
93
+ - `migrate` inside `pipelined`/`multi` now falls back to the client's `db` and `timeout` instead
94
+ of the pipeline's. (#1381)
95
+ - `himport_prepare` snapshots the field names at preparation time, so mutating the strings
96
+ afterwards no longer changes the schema used for automatic re-preparation. (#1380)
97
+ - `ft_aggregate` now sends the right `LOAD` field count when the fields are given as nested
98
+ arrays. (#1379)
99
+ - In `pipelined(exception: false)`, errors are no longer passed through the reply reshaping
100
+ lambdas, the flag now also applies to `multi` inside the pipeline, and when `EXEC` aborts the
101
+ transaction's command futures hold the error instead of staying unresolved. (#1377)
102
+ - Only fall back to RESP2 when `HELLO` itself fails with `NOPROTO`, instead of on any command
103
+ error whose message contains `NOPROTO`. (#1376)
104
+ - `Redis::HashRing#remove_node` filters the ring positions once instead of once per replica.
105
+ (#1378)
106
+
107
+ ## Maintenance
108
+
109
+ - Pin `redis-client` to `0.31.0`. (#1400)
110
+ - Pin `redis-cluster-client` to `0.18.0`; see cluster/CHANGELOG.md for the routing changes it
111
+ brings to `Redis::Cluster`. (#1375, #1395)
112
+ - Document the `himport_auto_prepare` client option. (#1370)
113
+ - Add CONTRIBUTORS.md. (#1410)
114
+
1
115
  # 6.0.0
2
116
 
3
117
  ## Breaking changes
data/README.md CHANGED
@@ -182,6 +182,13 @@ end
182
182
  MyApp.redis.incr("some-counter")
183
183
  ```
184
184
 
185
+ ## Ractors
186
+
187
+ `Redis` instances can be used in non-main Ractors, one per Ractor. Require
188
+ `redis/ractorize` in the main Ractor first, after anything that adds to
189
+ `Redis::Client::ERROR_MAPPING`, such as `redis-clustering`. In other Ractors,
190
+ leave out the `driver` option or pass a driver class.
191
+
185
192
  ## Sentinel support
186
193
 
187
194
  The client is able to perform automatic failover by using [Redis
@@ -371,10 +378,10 @@ disconnect or `RESET`. A `himport_set` on a connection without the fieldset
371
378
  fails with `ERR no such fieldset`.
372
379
 
373
380
  Because a `Redis` instance transparently replaces a dead connection (see
374
- [Reconnections](#reconnections)), the client keeps the last schema prepared for
375
- each fieldset name and, when a `himport_set` reports the fieldset is gone,
376
- re-prepares it and retries the command once. Explicitly discarded fieldsets are
377
- never restored. To keep the fieldset lifecycle fully explicit instead, disable
381
+ [Reconnections](#reconnections)), the client keeps all fieldset schemas
382
+ and, when a `himport_set` reports the fieldset is gone, re-prepares it
383
+ and retries the command once. Explicitly discarded fieldsets are never
384
+ restored. To keep the fieldset lifecycle fully explicit instead, disable
378
385
  the recovery:
379
386
 
380
387
  ```ruby
@@ -406,6 +413,165 @@ reply per node; `himport_set` routes by key. With `Redis::Cluster`, the same
406
413
  commands fan out to every master node and return a single aggregated reply,
407
414
  matching the standalone API.
408
415
 
416
+ ## Hot key tracking (HOTKEYS)
417
+
418
+ Redis 8.6 adds the `HOTKEYS` command family, which ranks the keys that consume
419
+ the most CPU time and/or network bytes during a tracking session:
420
+
421
+ ```ruby
422
+ redis.hotkeys_start(metrics: [:cpu, :net], count: 10) # => "OK"
423
+ # ... let traffic flow ...
424
+ result = redis.hotkeys_get
425
+ result["by-cpu-time-us"] # => [["product:1", 1070], ["product:2", 67]]
426
+ result["by-net-bytes"] # => [["product:1", 411], ["product:2", 37]]
427
+ redis.hotkeys_stop # => "OK" (nil when no session is active)
428
+ redis.hotkeys_reset # => "OK"; hotkeys_get now returns nil
429
+ ```
430
+
431
+ `hotkeys_start` also accepts `duration:` (seconds after which the session stops
432
+ by itself), `sample:` (track one command in N) and, in cluster mode, `slots:`.
433
+ `hotkeys_get` returns a Hash keyed by the server's field names: the
434
+ `total-cpu-time-*-ms` and `by-cpu-time-us` fields are present only when `:cpu`
435
+ was requested, `total-net-bytes` and `by-net-bytes` only when `:net` was. The
436
+ `by-*` lists are `[key, value]` pairs, hottest first, with at most `count`
437
+ entries.
438
+
439
+ A tracking session is state of the server, shared by every connection, and only
440
+ one can run at a time. Because the commands can be neither routed by key nor
441
+ aggregated across nodes, they are only available on a single-node client:
442
+ `Redis::Cluster` and `Redis::Distributed` raise `NotImplementedError`. To
443
+ profile one node of a cluster or ring, connect to it directly with
444
+ `Redis.new(host:, port:)`. The same applies inside `pipelined`/`multi` blocks
445
+ on `Redis::Cluster`.
446
+
447
+ ## Compare-and-set (CAS/CAD)
448
+
449
+ Redis 8.4 adds atomic compare-and-set to `SET` and a new compare-and-delete command,
450
+ `DELEX`, so operations like "extend my lock if I still hold it" or "release my lock only if
451
+ it's still mine" no longer need `WATCH`/`GET`/`MULTI`/`EXEC` or Lua:
452
+
453
+ ```ruby
454
+ token = SecureRandom.uuid
455
+ redis.set("lock:my-resource", token, nx: true, ex: 30) # acquire
456
+
457
+ redis.set("lock:my-resource", token, ex: 30, ifeq: token) # extend, only if still held
458
+ redis.delex("lock:my-resource", ifeq: token) # release, only if still held
459
+ ```
460
+
461
+ `:ifeq`/`:ifne` compare against the key's current value directly; `:ifdeq`/`:ifdne` compare
462
+ against a digest instead, useful when the value itself is large and you'd rather not transmit
463
+ it twice. Fetch a digest from the server with `DIGEST`:
464
+
465
+ ```ruby
466
+ digest = redis.digest("mykey")
467
+ redis.set("mykey", "new value", ifdeq: digest)
468
+ ```
469
+
470
+ `:nx`, `:xx`, `:ifeq`, `:ifne`, `:ifdeq`, and `:ifdne` are all mutually exclusive.
471
+
472
+ ### Computing a digest locally
473
+
474
+ `Redis::XXH3.hexdigest` computes the same XXH3-64 digest `DIGEST` returns, without a round
475
+ trip — useful when you already have the value on the client and just need a digest to compare
476
+ against:
477
+
478
+ ```ruby
479
+ require "redis/xxh3"
480
+
481
+ digest = Redis::XXH3.hexdigest(value)
482
+ redis.set("mykey", value, ifdeq: digest) # only writes if the current value still hashes to digest
483
+ ```
484
+
485
+ It's a pure-Ruby port of the same reference xxHash algorithm the Redis server itself uses, so a
486
+ digest computed this way and one fetched via `DIGEST` for the same value are always
487
+ byte-identical. No native extension, no build step — it's always available.
488
+
489
+ ## Keyspace Notifications
490
+
491
+ Redis can publish an event on pub/sub for every change to the dataset
492
+ (`__keyspace@0__:<key>` / `__keyevent@0__:<event>` channels; Redis 8.8 adds
493
+ subkey-level channels for hash fields). The feature must be enabled on the
494
+ **server** via the `notify-keyspace-events` config — this gem deliberately does
495
+ not set it for you (`CONFIG` is often restricted, and runtime changes don't
496
+ survive restarts or reach new nodes):
497
+
498
+ ```
499
+ redis-cli config set notify-keyspace-events KEA # or KEASTIV for Redis 8.8 subkey events
500
+ ```
501
+
502
+ The simplest way to consume notifications is the manager, which owns a
503
+ dedicated connection and background thread and dispatches typed notifications
504
+ to handlers:
505
+
506
+ ```ruby
507
+ manager = redis.keyspace_notifications
508
+
509
+ manager.subscribe_keyevent("expired") { |n| cache.delete(n.key) }
510
+ manager.subscribe_keyspace("user:*") { |n| puts "#{n.event} on #{n.key}" }
511
+ manager.subscribe_subkeyspace("session:*") { |n| p n.subkeys } # Redis 8.8+
512
+ manager.on_reconnect { cache.clear } # delivery is fire-and-forget; reconcile after gaps
513
+
514
+ manager.close
515
+ ```
516
+
517
+ Channel builders (`Redis::KeyspaceNotifications::Channels`) and a binary-safe
518
+ parser (`Redis::KeyspaceNotifications::Parser.parse(channel, payload)`) are
519
+ also usable directly with the plain `subscribe`/`psubscribe` API.
520
+
521
+ ### Subkey notifications (Redis 8.8+)
522
+
523
+ Classic notifications only say *which key* changed. Redis 8.8 adds four subkey
524
+ channel families that also carry *which elements inside the value* changed —
525
+ hash fields today, with the model designed to extend to other types. Parsed
526
+ notifications expose them as `subkeys`: an ordered list (duplicates preserved)
527
+ whose meaning is determined by the event (`hset` → hash fields):
528
+
529
+ ```ruby
530
+ manager.subscribe_subkeyspace("session:*") do |n|
531
+ # HSET session:1 token abc ttl 30 => event="hset", key="session:1", subkeys=["token", "ttl"]
532
+ n.subkeys.each { |field| invalidate(n.key, field) }
533
+ end
534
+
535
+ # Watch one exact key + field pair (server-side filtering):
536
+ manager.subscribe_subkeyspaceitem("session:1", "token") { |n| p n.event }
537
+
538
+ # Or by event, with a key pattern:
539
+ manager.subscribe_subkeyspaceevent("hexpire", "session:*") { |n| p n.subkeys }
540
+ ```
541
+
542
+ Subkey families are gated by their own `notify-keyspace-events` flags — `S`
543
+ (subkeyspace), `T` (subkeyevent), `I` (subkeyspaceitem), `V` (subkeyspaceevent) —
544
+ **and additionally require the data-type flag**: `STIV` alone emits nothing for
545
+ hashes; use `STIVh`, or `KEASTIV` to combine with the classic channels. Keys and
546
+ subkeys may contain arbitrary bytes, so the wire payloads are length-prefixed
547
+ and the parser is binary-safe — `key`/`subkeys` are returned as BINARY-encoded
548
+ strings.
549
+
550
+ **Connection pooling:** create **one manager per process**, not per pooled
551
+ connection — pub/sub is a broadcast, so N managers means every event is
552
+ delivered and handled N times, not load-shared. The manager is not a pooled
553
+ resource: it owns a private connection duplicated from the client's options, so
554
+ `pool.with { |redis| redis.keyspace_notifications }` is safe (nothing of the
555
+ checked-out client is retained) and the manager outlives the checkout. Handlers
556
+ may briefly check pool connections out for Redis work; in forking servers
557
+ (Puma, Sidekiq), create the manager in an after-fork hook, one per worker. See
558
+ `examples/keyspace_notifications_pool.rb`.
559
+
560
+ **Cluster:** notifications are node-local — a plain `subscribe` on a
561
+ `Redis::Cluster` reaches one node and silently misses the rest. Use
562
+ `cluster.keyspace_notifications`, which subscribes on every primary and
563
+ reconciles reactively on connection errors (call `#refresh` after adding
564
+ primaries). `on_reconnect { |node_key| ... }` fires after a node's
565
+ subscriptions were re-established — events it emitted during the gap are lost,
566
+ so reconcile there. Remember to enable `notify-keyspace-events` on **every
567
+ node, replicas included** — a promoted replica keeps its own config.
568
+
569
+ Never `PUBLISH` to notification channels yourself; the server owns them.
570
+ See [specs/keyspace-notifications/user-guide.md](specs/keyspace-notifications/user-guide.md)
571
+ for wire formats, threading/lifecycle semantics and the full API, and
572
+ `examples/keyspace_notifications.rb` for a runnable demo. `Redis::Distributed`
573
+ is not supported.
574
+
409
575
  ## Error Handling
410
576
 
411
577
  In general, if something goes wrong you'll get an exception. For example, if
@@ -590,7 +756,8 @@ client and evangelized Redis in Rubyland. Thank you, Ezra.
590
756
  ## Contributing
591
757
 
592
758
  [Fork the project](https://github.com/redis/redis-rb) and send pull
593
- requests.
759
+ requests. See [CONTRIBUTORS.md](CONTRIBUTORS.md) for development setup,
760
+ how to run the test suite, and what a pull request needs before merge.
594
761
 
595
762
 
596
763
  [rdoc-master-image]: https://img.shields.io/badge/docs-rdoc.info-blue.svg
data/lib/redis/client.rb CHANGED
@@ -41,7 +41,9 @@ class Redis
41
41
  # by redis-client as UnsupportedServer) and any server replying NOPROTO to `HELLO 3`.
42
42
  def resp3_unsupported?(error)
43
43
  return true if error.is_a?(::RedisClient::UnsupportedServer)
44
- return true if error.is_a?(::RedisClient::CommandError) && error.message.include?("NOPROTO")
44
+ if error.is_a?(::RedisClient::CommandError)
45
+ return error.command&.first&.casecmp?("HELLO") && error.message.match?(/\ANOPROTO(?: |$)/)
46
+ end
45
47
 
46
48
  # Redis::Cluster discovers its topology by connecting to each startup node. When those nodes
47
49
  # don't speak RESP3, redis-cluster-client collects the per-node failures and re-raises them
@@ -60,6 +62,8 @@ class Redis
60
62
  mapping.fetch(error_class)
61
63
  rescue IndexError
62
64
  if (client_error = error_class.ancestors.find { |a| mapping[a] })
65
+ return mapping[client_error] if mapping.frozen?
66
+
63
67
  mapping[error_class] = mapping[client_error]
64
68
  else
65
69
  raise