mongo_ha 1.11.3 → 1.12.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 89d04c7e0d88bf50ad147143668ea57972f1eab1
4
- data.tar.gz: cc5df8018e365e95f47d9694c4b1783a6ef80819
3
+ metadata.gz: ad71f9ce35d35356156317b4b046a7de1b67540f
4
+ data.tar.gz: e6f9363d0ce50cd150f6bf5c47d54dc0de558973
5
5
  SHA512:
6
- metadata.gz: 08cb5c187dc5c37da6fe7bb2c2513cade426a570a6f51928ca3dd443764c9536f8bf957dfeea8c74a56ec8deda079a7d347b70a49efdfdafafba6bcd5ab15ff8
7
- data.tar.gz: eec6f0d8fb69f83171674dd769034f04826f5f6eb691618315ebecc41b2e65c54462fbced2871570fd77a018fe37b7345ccf0c1f3f383f6ea3be6207dcc9a9b3
6
+ metadata.gz: ac614677db69523d94534597f73a861c4806e9deb01a58af3f4bdb24805d74aa32676f717aabc5e5ccbd44380557bd1f54b32c5842a60c40adf60bd2e073a8ec
7
+ data.tar.gz: 7336be2ce42a935d22ef7f79a4478db128a127a3e100e5a4c9da2a607facca9ec0140f6f6d1039813d7c5f1704ddaaac64f788e02fe997e40608d16f08157f09
data/README.md CHANGED
@@ -26,13 +26,12 @@ servers with reconnect attempts.
26
26
  Retries are initially performed quickly in case it is a brief network issue
27
27
  and then backs off to give the replica-set time to elect a new master.
28
28
 
29
- Currently Only Supports Ruby Mongo driver v1.11.x. Submit an issue if other versions
30
- need support too.
29
+ Supports Ruby Mongo driver V1.x.x
31
30
 
32
31
  `mongo_ha` transparently supports `MongoMapper` since it uses the mongo ruby driver
33
32
  that is patched by loading this gem. Earlier versions of Mongoid will also benefit
34
- from `mongo_ha`, the latest version of Mongoid uses Moped that should be avoided and is
35
- due to be replaced.
33
+ from `mongo_ha`, the latest version of Mongoid uses Moped that should be avoided
34
+ since it is due to be replaced by the Ruby Mongo driver V2 when it is released.
36
35
 
37
36
  Mongo Router processes will often return a connection failure on their side
38
37
  as an OperationFailure. This code will also retry automatically when the router
@@ -1,3 +1,3 @@
1
1
  module MongoHA #:nodoc
2
- VERSION = "1.11.3"
2
+ VERSION = "1.12.0"
3
3
  end
data/lib/mongo_ha.rb CHANGED
@@ -1,15 +1,10 @@
1
1
  require 'mongo'
2
2
  require 'mongo_ha/version'
3
3
  require 'mongo_ha/mongo_client'
4
- require 'mongo_ha/networking'
5
4
 
6
5
  # Add in retry methods
7
6
  Mongo::MongoClient.send(:include, MongoHA::MongoClient::InstanceMethods)
8
7
 
9
- # Ensure connection is checked back into the pool when exceptions are thrown
10
- # The following line is no longer required with Mongo V1.12 and above
11
- Mongo::Networking.send(:include, MongoHA::Networking::InstanceMethods)
12
-
13
8
  # Wrap critical Mongo methods with retry_on_connection_failure
14
9
  {
15
10
  Mongo::Collection => [
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.11.3
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reid Morrison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-13 00:00:00.000000000 Z
11
+ date: 2015-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongo
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.11.0
19
+ version: '1.12'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.11.0
26
+ version: '1.12'
27
27
  description: Automatic reconnects and recovery when replica-set changes, or connections
28
28
  are lost, with transparent recovery
29
29
  email:
@@ -36,7 +36,6 @@ files:
36
36
  - Rakefile
37
37
  - lib/mongo_ha.rb
38
38
  - lib/mongo_ha/mongo_client.rb
39
- - lib/mongo_ha/networking.rb
40
39
  - lib/mongo_ha/version.rb
41
40
  homepage: https://github.com/reidmorrison/mongo_ha
42
41
  licenses:
@@ -1,58 +0,0 @@
1
- module MongoHA
2
- module Networking
3
- module InstanceMethods
4
- def self.included(base)
5
- base.class_eval do
6
- # Fix problem where a Timeout exception is not checking the socket back into the pool
7
- # Based on code from Gem V1.11.1, not needed with V1.12 or above
8
- # Only change is the ensure block
9
- def send_message_with_gle(operation, message, db_name, log_message=nil, write_concern=false)
10
- docs = num_received = cursor_id = ''
11
- add_message_headers(message, operation)
12
-
13
- last_error_message = build_get_last_error_message(db_name, write_concern)
14
- last_error_id = add_message_headers(last_error_message, Mongo::Constants::OP_QUERY)
15
-
16
- packed_message = message.append!(last_error_message).to_s
17
- sock = nil
18
- begin
19
- sock = checkout_writer
20
- send_message_on_socket(packed_message, sock)
21
- docs, num_received, cursor_id = receive(sock, last_error_id)
22
- # Removed checkin
23
- # checkin(sock)
24
- rescue Mongo::ConnectionFailure, Mongo::OperationFailure, Mongo::OperationTimeout => ex
25
- # Removed checkin
26
- # checkin(sock)
27
- raise ex
28
- rescue SystemStackError, NoMemoryError, SystemCallError => ex
29
- close
30
- raise ex
31
- # Added ensure block to always check sock back in
32
- ensure
33
- checkin(sock) if sock
34
- end
35
-
36
- if num_received == 1
37
- error = docs[0]['err'] || docs[0]['errmsg']
38
- if error && error.include?("not master")
39
- close
40
- raise Mongo::ConnectionFailure.new(docs[0]['code'].to_s + ': ' + error, docs[0]['code'], docs[0])
41
- elsif (!error.nil? && note = docs[0]['jnote'] || docs[0]['wnote']) # assignment
42
- code = docs[0]['code'] || Mongo::ErrorCode::BAD_VALUE # as of server version 2.5.5
43
- raise Mongo::WriteConcernError.new(code.to_s + ': ' + note, code, docs[0])
44
- elsif error
45
- code = docs[0]['code'] || Mongo::ErrorCode::UNKNOWN_ERROR
46
- error = "wtimeout" if error == "timeout"
47
- raise Mongo::WriteConcernError.new(code.to_s + ': ' + error, code, docs[0]) if error == "wtimeout"
48
- raise Mongo::OperationFailure.new(code.to_s + ': ' + error, code, docs[0])
49
- end
50
- end
51
-
52
- docs[0]
53
- end
54
- end
55
- end
56
- end
57
- end
58
- end