redis-clustering 5.4.0 → 6.0.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +29 -0
- data/lib/redis/cluster/client.rb +9 -5
- data/lib/redis/cluster.rb +44 -2
- metadata +11 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2e9c31d780e291ac7df46dc423f6460bdd92e357d490c13a45ec83094dd078f3
|
|
4
|
+
data.tar.gz: 5125a590e44be00d49640e82354dbffc7baf8d819219c512a2896809aabab3c7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 86f573a8390cba746e75d4585101e05070f4a709c2e9eddc22130189379d8e2b7580dd7595d54b80842a121a8f17ebe693a3b7664e1bc4f791d07e1a8c1a489f
|
|
7
|
+
data.tar.gz: 221e1b270ee3838413598d3dc2280e3021c627daabddbb0454fd32fd2e5cab11507e1fa16b940163379b362bb9945230ffc5237ece4d7705d648b22f9255c77a
|
data/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# 6.0.0
|
|
2
|
+
|
|
3
|
+
## Breaking changes
|
|
4
|
+
|
|
5
|
+
- Route commands by their server-declared command tips (redis-cluster-client 0.16.6+):
|
|
6
|
+
`SLOWLOG GET` now returns one entry list per master; `SLOWLOG LEN` and `LATENCY RESET` return
|
|
7
|
+
the sum across all masters; `FUNCTION LOAD`/`DELETE`/`FLUSH`/`RESTORE` now execute on all
|
|
8
|
+
masters; commands with keys in subcommands (e.g. `XINFO STREAM`) route to the key's slot owner.
|
|
9
|
+
- Use RESP3 (`HELLO 3`) by default; pass `protocol: 2` to keep RESP2. `GEOPOS` and
|
|
10
|
+
`GEOSEARCH`/`GEORADIUS` with `WITHCOORD` now return coordinates as `Float` instead of `String`.
|
|
11
|
+
See [the RESP3 migration guide](../specs/migration-resp3.md). (#1351)
|
|
12
|
+
- Require Ruby 3.2+. (#1353, #1365)
|
|
13
|
+
|
|
14
|
+
## New features
|
|
15
|
+
|
|
16
|
+
- Identify the client to every node via `CLIENT SETINFO` (`lib-name=redis-rb`,
|
|
17
|
+
`lib-ver=<version>`). Extend the reported name with `driver_info:`, or disable with
|
|
18
|
+
`driver_info: false`. (#1369)
|
|
19
|
+
|
|
20
|
+
## Experimental
|
|
21
|
+
|
|
22
|
+
- Add `himport_prepare`, `himport_set`, `himport_discard` and `himport_discard_all`
|
|
23
|
+
(Redis 8.10 `HIMPORT`). Prepare/discard fan out to all masters; `himport_set` routes by its
|
|
24
|
+
key's hash slot. Lost fieldsets are re-prepared and retried automatically; disable with
|
|
25
|
+
`himport_auto_prepare: false`. The API may change in a future minor release. (#1364)
|
|
26
|
+
|
|
27
|
+
## Maintenance
|
|
28
|
+
|
|
29
|
+
- Pin `redis-cluster-client` to the exact version `0.16.7`.
|
data/lib/redis/cluster/client.rb
CHANGED
|
@@ -16,18 +16,18 @@ class Redis
|
|
|
16
16
|
)
|
|
17
17
|
|
|
18
18
|
class << self
|
|
19
|
-
def config(**kwargs)
|
|
20
|
-
super(protocol:
|
|
19
|
+
def config(protocol: 3, **kwargs)
|
|
20
|
+
super(protocol: protocol, **kwargs)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
def sentinel(**kwargs)
|
|
24
|
-
super(protocol:
|
|
23
|
+
def sentinel(protocol: 3, **kwargs)
|
|
24
|
+
super(protocol: protocol, **kwargs)
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def translate_error!(error, mapping: ERROR_MAPPING)
|
|
28
28
|
case error
|
|
29
29
|
when RedisClient::Cluster::ErrorCollection
|
|
30
|
-
error.errors.
|
|
30
|
+
error.errors.each_value do |node_error|
|
|
31
31
|
if node_error.is_a?(RedisClient::AuthenticationError)
|
|
32
32
|
raise mapping.fetch(node_error.class), node_error.message, node_error.backtrace
|
|
33
33
|
end
|
|
@@ -132,6 +132,10 @@ class Redis
|
|
|
132
132
|
def handle_errors
|
|
133
133
|
yield
|
|
134
134
|
rescue ::RedisClient::Error => error
|
|
135
|
+
# Let RESP3-unsupported errors (e.g. a node without HELLO) propagate untranslated so
|
|
136
|
+
# Redis#send_command can transparently fall back to RESP2.
|
|
137
|
+
raise if Redis::Client.resp3_unsupported?(error)
|
|
138
|
+
|
|
135
139
|
Redis::Cluster::Client.translate_error!(error)
|
|
136
140
|
end
|
|
137
141
|
end
|
data/lib/redis/cluster.rb
CHANGED
|
@@ -63,9 +63,13 @@ class Redis
|
|
|
63
63
|
# @option options [String] :fixed_hostname Specify a FQDN if cluster mode enabled and
|
|
64
64
|
# client has to connect nodes via single endpoint with SSL/TLS
|
|
65
65
|
# @option options [Class] :connector Class of custom connector
|
|
66
|
+
# @option options [String, Array<String>, false] :driver_info Identity a library built on top of
|
|
67
|
+
# `redis-rb` reports to every node via `CLIENT SETINFO`, shown as `lib-name=redis-rb(<driver_info>)`
|
|
68
|
+
# in `CLIENT LIST`. The recommended format is `<name>_v<version>`; an Array is joined with `;`.
|
|
69
|
+
# Pass `false` to disable client identification entirely.
|
|
66
70
|
#
|
|
67
71
|
# @return [Redis::Cluster] a new client instance
|
|
68
|
-
def initialize(*)
|
|
72
|
+
def initialize(*)
|
|
69
73
|
super
|
|
70
74
|
end
|
|
71
75
|
ruby2_keywords :initialize if respond_to?(:ruby2_keywords, true)
|
|
@@ -125,10 +129,48 @@ class Redis
|
|
|
125
129
|
synchronize { |c| c.watch(*keys, &block) }
|
|
126
130
|
end
|
|
127
131
|
|
|
132
|
+
# HIMPORT on cluster: redis-cluster-client (>= 0.16.6) routes the whole family natively from
|
|
133
|
+
# the server's command metadata — PREPARE/DISCARD/DISCARDALL fan out to all primaries per
|
|
134
|
+
# their request_policy:all_shards tip (fieldsets are per-connection session state, so every
|
|
135
|
+
# primary's connection needs its own copy), and SET routes by its key's slot via the
|
|
136
|
+
# per-subcommand key spec. HIMPORT defines no response_policy today, so fan-out replies
|
|
137
|
+
# arrive as one-per-primary arrays; these overrides aggregate them for standalone/cluster
|
|
138
|
+
# API parity: PREPARE returns the first "OK" (all-or-raise), the discards return the max
|
|
139
|
+
# across primaries — per-node integers can legitimately diverge when a node joined after
|
|
140
|
+
# the PREPARE. The Array guard keeps the user-facing contract ("OK" / Integer) stable if a
|
|
141
|
+
# future server release adds a response_policy: the driver then aggregates the fan-out
|
|
142
|
+
# itself and hands us a scalar, which we pass through instead of crashing on String#first.
|
|
143
|
+
# Partial fan-out failures raise Redis::Cluster::CommandErrorCollection whose #errors hash
|
|
144
|
+
# tells you which nodes failed; nodes that replied OK keep their fieldsets.
|
|
145
|
+
#
|
|
146
|
+
# The fieldset registry, monitor atomicity and loss-recovery (on "no such fieldset" the
|
|
147
|
+
# last prepared schema is re-fanned out — through these overrides — and the SET retried
|
|
148
|
+
# once) are inherited from the Redis superclass unchanged; `himport_set` needs no override.
|
|
149
|
+
|
|
150
|
+
def himport_prepare(fieldset_name, *fields)
|
|
151
|
+
reply = super
|
|
152
|
+
reply.is_a?(Array) ? reply.first : reply
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def himport_discard(fieldset_name)
|
|
156
|
+
reply = super
|
|
157
|
+
reply.is_a?(Array) ? reply.max : reply
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def himport_discard_all
|
|
161
|
+
reply = super
|
|
162
|
+
reply.is_a?(Array) ? reply.max : reply
|
|
163
|
+
end
|
|
164
|
+
|
|
128
165
|
private
|
|
129
166
|
|
|
130
167
|
def initialize_client(options)
|
|
131
|
-
|
|
168
|
+
# protocol defaults to 3 (RESP3) but a caller-provided protocol: in options overrides it.
|
|
169
|
+
cluster_config = RedisClient.cluster(
|
|
170
|
+
protocol: 3, **options,
|
|
171
|
+
driver_info: ::Redis::LibIdentity.driver_info(options[:driver_info]),
|
|
172
|
+
client_implementation: ::Redis::Cluster::Client
|
|
173
|
+
)
|
|
132
174
|
cluster_config.new_client
|
|
133
175
|
end
|
|
134
176
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: redis-clustering
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 6.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ezra Zygmuntowicz
|
|
@@ -15,7 +15,7 @@ authors:
|
|
|
15
15
|
- Pieter Noordhuis
|
|
16
16
|
bindir: bin
|
|
17
17
|
cert_chain: []
|
|
18
|
-
date:
|
|
18
|
+
date: 2026-07-31 00:00:00.000000000 Z
|
|
19
19
|
dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|
|
21
21
|
name: redis
|
|
@@ -23,28 +23,28 @@ dependencies:
|
|
|
23
23
|
requirements:
|
|
24
24
|
- - '='
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
26
|
+
version: 6.0.0
|
|
27
27
|
type: :runtime
|
|
28
28
|
prerelease: false
|
|
29
29
|
version_requirements: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - '='
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
33
|
+
version: 6.0.0
|
|
34
34
|
- !ruby/object:Gem::Dependency
|
|
35
35
|
name: redis-cluster-client
|
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
|
-
- -
|
|
38
|
+
- - '='
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 0.
|
|
40
|
+
version: 0.16.7
|
|
41
41
|
type: :runtime
|
|
42
42
|
prerelease: false
|
|
43
43
|
version_requirements: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
|
-
- -
|
|
45
|
+
- - '='
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: 0.
|
|
47
|
+
version: 0.16.7
|
|
48
48
|
description: |2
|
|
49
49
|
A Ruby client that tries to match Redis' Cluster API one-to-one, while still
|
|
50
50
|
providing an idiomatic interface.
|
|
@@ -68,9 +68,9 @@ licenses:
|
|
|
68
68
|
metadata:
|
|
69
69
|
bug_tracker_uri: https://github.com/redis/redis-rb/issues
|
|
70
70
|
changelog_uri: https://github.com/redis/redis-rb/blob/master/cluster/CHANGELOG.md
|
|
71
|
-
documentation_uri: https://www.rubydoc.info/gems/redis/
|
|
71
|
+
documentation_uri: https://www.rubydoc.info/gems/redis/6.0.0
|
|
72
72
|
homepage_uri: https://github.com/redis/redis-rb/blob/master/cluster
|
|
73
|
-
source_code_uri: https://github.com/redis/redis-rb/tree/
|
|
73
|
+
source_code_uri: https://github.com/redis/redis-rb/tree/v6.0.0/cluster
|
|
74
74
|
rdoc_options: []
|
|
75
75
|
require_paths:
|
|
76
76
|
- lib
|
|
@@ -78,7 +78,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
78
78
|
requirements:
|
|
79
79
|
- - ">="
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
|
-
version: 2.
|
|
81
|
+
version: 3.2.0
|
|
82
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
83
|
requirements:
|
|
84
84
|
- - ">="
|