-
Type: Bug
-
Resolution: Done
-
Priority: Critical - P2
-
Affects Version/s: 1.5.1
-
Component/s: None
I performed the following sequence of operations:
- Connected to a 3-node replica set using 1.5.1:
>> m = Mongo::ReplSetConnection.new(['127.0.0.1', 6001], ['127.0.0.1', 6002], ['127.0.0.1', 6003]); m.primary
=> ["qa-dev1.stripe.com", 6002]
- Did an rs.stepDown() on the master
- On the next request, as expected, an error was raised:
>> m['test']['tar'].insert({}, :safe => true)
Mongo::ConnectionFailure: Operation failed with the following exception: Connection reset by peer
from /usr/lib/ruby/gems/1.8/gems/mongo-1.5.1/lib/../lib/mongo/networking.rb:312:in `receive_message_on_socket'
from /usr/lib/ruby/gems/1.8/gems/mongo-1.5.1/lib/../lib/mongo/networking.rb:169:in `receive_header'
from /usr/lib/ruby/gems/1.8/gems/mongo-1.5.1/lib/../lib/mongo/collection.rb:944:in `insert_documents'
...
- On the next request, it appears the connection is trying to write to the wrong node:
>> m['test']['tar'].insert({}, :safe => true)
Mongo::OperationFailure: 10058: not master
from /usr/lib/ruby/gems/1.8/gems/mongo-1.5.1/lib/../lib/mongo/networking.rb:82:in `send_message_with_safe_check'
from /usr/lib/ruby/gems/1.8/gems/mongo-1.5.1/lib/../lib/mongo/collection.rb:946:in `insert_documents'
- Indeed, the primary hasn't updated:
>> m.primary
=> ["qa-dev1.stripe.com", 6002]
- is related to
-
RUBY-379 ReplSetConnection not automatically switching after rs stepdown/reconfig
- Closed