Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-509

ReplSetConnection.new should throw ArgumentException if arg2 thru argN-1 are passed but not used

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.8.1
    • Affects Version/s: 1.3.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      Ubuntu Lucid 10.04
      Ruby 1.8.7

      The order of the arguments to Mongo::ReplSetConnection#new seems to affect whether it connects: (mongo02 is the primary)

      irb(main):001:0> Mongo::ReplSetConnection.new(['mongo01', 27017], ['mongo02', 27017])
      Mongo::ConnectionFailure: Failed to connect to primary node.
      from gems/mongo-1.3.0/lib/../lib/mongo/repl_set_connection.rb:128:in `connect'
      from gems/mongo-1.3.0/lib/../lib/mongo/connection.rb:632:in `setup'
      from gems/mongo-1.3.0/lib/../lib/mongo/repl_set_connection.rb:93:in `initialize'
      from (irb):1:in `new'
      from (irb):1
      irb(main):002:0> Mongo::ReplSetConnection.new(['mongo02', 27017], ['mongo01', 27017])
      => #<Mongo::ReplSetConnection:0x117f0d30 @nodes_tried=[["mongo02", 27017], ["mongo02", 27017], ["mongo01", 27017], ["db01", 27017]], @safe=false, @pool_size=1, @read_secondary=false, @auths=[], @secondaries=[], @primary=["mongo02", 27017], @timeout=5.0, @id_lock=#<Mutex:0x117f0bc8>, @read_pool=nil, @primary_pool=#<Mongo::Pool:0x117ef2f0 @checked_out=[], @socket_ops=

      {#<TCPSocket:0x117ee008>=>[]}

      , @timeout=5.0, @size=1, @pids=

      {#<TCPSocket:0x117ee008>=>25920}

      , @port=27017, @queue=#<ConditionVariable:0x117ef250>, @sockets=[#<TCPSocket:0x117ee008>], @host="mongo02", @connection=#<Mongo::ReplSetConnection:0x117f0d30 ...>, @connection_mutex=#<Mutex:0x117ef278>>, @replica_set=nil, @logger=nil, @queue=#<ConditionVariable:0x117f0b28>, @secondary_pools=[], @nodes=[["mongo02", 27017], ["mongo01", 27017], ["db01", 27017]], @nodes_to_try=[], @op_timeout=nil, @safe_mutexes=

      {#<TCPSocket:0x117f0998>=>#<Mutex:0x117eff70>, #<TCPSocket:0x117ee008>=>#<Mutex:0x117edea0>}

      , @connection_mutex=#<Mutex:0x117f0ba0>, @arbiters=[]>
      irb(main):003:0>

      Logs from the slave when it is the first argument:

      Tue Apr 12 17:23:15 [initandlisten] connection accepted from XX.XX.XX.XX:58122 #49
      Tue Apr 12 17:23:15 [conn49] end connection XX.XX.XX.XX:58122

      The primary shows no connection attempts at all.

            Assignee:
            tyler@10gen.com Tyler Brock
            Reporter:
            bascott@enphaseenergy.com Benjamin Abbott-Scott
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: