mongo_ha 1.12.1 → 1.12.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mongo_ha/mongo_client.rb +13 -4
- data/lib/mongo_ha/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a318867db1e1e333650522d58e80235f3af0f900
|
4
|
+
data.tar.gz: f9333bdd6a54c529c293b5871886c851c0c77d5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be3da7875c5ba4c307685f9ff56eea7e2dd4449906f0fd342a13719dbac8417f803b2f8912d2cd37f5a7fb2a4899594127eb8ae95d1ed057f95f3a252bf405cd
|
7
|
+
data.tar.gz: 5b1729d3d085267eeff6fe0144b13d421b00f7f47e4758714bde5d64941c34d51dec862f38c04770c31759ef3847aa0f5168bb9892691601196e172249252caa
|
@@ -15,7 +15,7 @@ module MongoHA
|
|
15
15
|
# Operation failed with the following exception: Bad file descriptor - Bad file descriptor:Bad file descriptor - Bad file descriptor
|
16
16
|
# Failed to connect to primary node.
|
17
17
|
# 10009: ReplicaSetMonitor no master found for set: mdbb
|
18
|
-
|
18
|
+
OPERATION_FAILURE_ERRORS = [
|
19
19
|
'socket exception',
|
20
20
|
'Connection reset by peer',
|
21
21
|
'transport error',
|
@@ -29,6 +29,7 @@ module MongoHA
|
|
29
29
|
'not master',
|
30
30
|
'Timed out waiting on socket',
|
31
31
|
"didn't get writeback",
|
32
|
+
'interrupted at shutdown'
|
32
33
|
]
|
33
34
|
|
34
35
|
module InstanceMethods
|
@@ -59,7 +60,7 @@ module MongoHA
|
|
59
60
|
# connection failures
|
60
61
|
@@failover_mutex = Mutex.new
|
61
62
|
|
62
|
-
|
63
|
+
private
|
63
64
|
|
64
65
|
def valid_opts(*args)
|
65
66
|
valid_opts_original(*args) + CONNECTION_RETRY_OPTS
|
@@ -103,6 +104,14 @@ module MongoHA
|
|
103
104
|
retry
|
104
105
|
end
|
105
106
|
raise exc
|
107
|
+
rescue Mongo::AuthenticationError => exc
|
108
|
+
# Retry once due to rare failures during authentication against MongoDB V3 servers
|
109
|
+
logger.warn "Authentication Failure: '#{exc.message}' [#{exc.error_code}]"
|
110
|
+
if !retried && _reconnect
|
111
|
+
retried = true
|
112
|
+
retry
|
113
|
+
end
|
114
|
+
raise exc
|
106
115
|
rescue Mongo::OperationFailure => exc
|
107
116
|
# Workaround not master issue. Disconnect connection when we get a not master
|
108
117
|
# error message. Master checks for an exact match on "not master", whereas
|
@@ -117,7 +126,7 @@ module MongoHA
|
|
117
126
|
# since it's connections to multiple remote shards may have failed.
|
118
127
|
# Disconnecting the current connection will not help since it is just to the mongos router
|
119
128
|
# First make sure it is connected to the mongos router
|
120
|
-
raise exc unless (
|
129
|
+
raise exc unless (OPERATION_FAILURE_ERRORS.any? { |err| exc.message.include?(err) }) || (exc.message.strip == ':')
|
121
130
|
|
122
131
|
mongos_retries += 1
|
123
132
|
if mongos_retries <= 60
|
@@ -132,7 +141,7 @@ module MongoHA
|
|
132
141
|
end
|
133
142
|
end
|
134
143
|
|
135
|
-
|
144
|
+
private
|
136
145
|
|
137
146
|
# Call this method whenever a Mongo::ConnectionFailure Exception
|
138
147
|
# has been raised to re-establish the connection
|
data/lib/mongo_ha/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongo_ha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.12.
|
4
|
+
version: 1.12.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reid Morrison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongo
|
@@ -40,7 +40,7 @@ files:
|
|
40
40
|
- test/readme.md
|
41
41
|
homepage: https://github.com/reidmorrison/mongo_ha
|
42
42
|
licenses:
|
43
|
-
- Apache
|
43
|
+
- Apache-2.0
|
44
44
|
metadata: {}
|
45
45
|
post_install_message:
|
46
46
|
rdoc_options: []
|
@@ -58,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
58
|
version: '0'
|
59
59
|
requirements: []
|
60
60
|
rubyforge_project:
|
61
|
-
rubygems_version: 2.
|
61
|
+
rubygems_version: 2.5.1
|
62
62
|
signing_key:
|
63
63
|
specification_version: 4
|
64
64
|
summary: High availability for the mongo ruby driver
|