redis_failover 0.9.5 → 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Changes.md +4 -0
- data/lib/redis_failover/node_manager.rb +16 -1
- data/lib/redis_failover/version.rb +1 -1
- metadata +3 -3
data/Changes.md
CHANGED
@@ -11,6 +11,7 @@ module RedisFailover
|
|
11
11
|
|
12
12
|
# Number of seconds to wait before retrying bootstrap process.
|
13
13
|
TIMEOUT = 3
|
14
|
+
|
14
15
|
# ZK Errors that the Node Manager cares about.
|
15
16
|
ZK_ERRORS = [
|
16
17
|
ZK::Exceptions::LockAssertionFailedError,
|
@@ -18,6 +19,14 @@ module RedisFailover
|
|
18
19
|
ZKDisconnectedError
|
19
20
|
].freeze
|
20
21
|
|
22
|
+
# Errors that can happen during the node discovery process.
|
23
|
+
NODE_DISCOVERY_ERRORS = [
|
24
|
+
InvalidNodeRoleError,
|
25
|
+
NodeUnavailableError,
|
26
|
+
NoMasterError,
|
27
|
+
MultipleMastersError
|
28
|
+
].freeze
|
29
|
+
|
21
30
|
# Creates a new instance.
|
22
31
|
#
|
23
32
|
# @param [Hash] options the options used to initialize the manager
|
@@ -248,7 +257,7 @@ module RedisFailover
|
|
248
257
|
redirect_slaves_to(@master)
|
249
258
|
true
|
250
259
|
end
|
251
|
-
rescue
|
260
|
+
rescue *NODE_DISCOVERY_ERRORS => ex
|
252
261
|
msg = <<-MSG.gsub(/\s+/, ' ')
|
253
262
|
Failed to discover master node: #{ex.inspect}
|
254
263
|
In order to ensure a safe startup, redis_failover requires that all redis
|
@@ -268,6 +277,12 @@ module RedisFailover
|
|
268
277
|
nodes = symbolize_keys(decode(data))
|
269
278
|
master = node_from(nodes[:master])
|
270
279
|
logger.info("Master from existing znode config: #{master || 'none'}")
|
280
|
+
# Check for case where a node previously thought to be the master was
|
281
|
+
# somehow manually reconfigured to be a slave outside of the node manager's
|
282
|
+
# control.
|
283
|
+
if master && master.slave?
|
284
|
+
raise InvalidNodeRoleError.new(master, :master, :slave)
|
285
|
+
end
|
271
286
|
master
|
272
287
|
end
|
273
288
|
rescue ZK::Exceptions::NoNode
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis_failover
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -189,7 +189,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
189
189
|
version: '0'
|
190
190
|
segments:
|
191
191
|
- 0
|
192
|
-
hash: -
|
192
|
+
hash: -1728937543756206393
|
193
193
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
194
194
|
none: false
|
195
195
|
requirements:
|
@@ -198,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
198
198
|
version: '0'
|
199
199
|
segments:
|
200
200
|
- 0
|
201
|
-
hash: -
|
201
|
+
hash: -1728937543756206393
|
202
202
|
requirements: []
|
203
203
|
rubyforge_project:
|
204
204
|
rubygems_version: 1.8.23
|