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

Cannot get operations in progress for sharded setup

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.1.0
    • Affects Version/s: 2.0.6
    • Component/s: Sharded Cluster
    • Labels:
      None

      We have code that looks like:

      client = Mongo::Client.new(..., connect: :sharded, database: 'admin')
      inprog = client['$cmd.sys.inprog'].find('$all' => true).limit(-1).skip(0).first
      

      This code works fine to find current operations for replicaset setups, but it does not work for sharded setups.

      The error we encounter is:

      Mongo::Error::OperationFailure: DBClientBase::findN: transport error: <ip>:27017 ns: admin.$cmd.sys.inprog query: { $query: { $all: true } } (10276)
      	from /app/vendor/bundle/ruby/2.1.0/gems/mongo-2.0.6/lib/mongo/operation/result.rb:214:in `validate!'
      	from /app/vendor/bundle/ruby/2.1.0/gems/mongo-2.0.6/lib/mongo/operation/read/query.rb:62:in `block in execute_message'
      	from /app/vendor/bundle/ruby/2.1.0/gems/mongo-2.0.6/lib/mongo/server/connection_pool.rb:99:in `with_connection'
      	from /app/vendor/bundle/ruby/2.1.0/gems/mongo-2.0.6/lib/mongo/server/context.rb:63:in `with_connection'
      	from /app/vendor/bundle/ruby/2.1.0/gems/mongo-2.0.6/lib/mongo/operation/read/query.rb:61:in `execute_message'
      	from /app/vendor/bundle/ruby/2.1.0/gems/mongo-2.0.6/lib/mongo/operation/read/query.rb:55:in `execute'
      	from /app/vendor/bundle/ruby/2.1.0/gems/mongo-2.0.6/lib/mongo/collection/view.rb:164:in `send_initial_query'
      	from /app/vendor/bundle/ruby/2.1.0/gems/mongo-2.0.6/lib/mongo/collection/view/iterable.rb:39:in `each'
      

      It's worth noting we're also using SSL.

      Looking at the code from the mongo shell, it seems like the only thing they do differently is disabling the read preference for the command. I have tried a few different read settings, none have worked in my testing.

      Would it be possible to get a special method to get current operations for a database? The way the code works, I don't think I can easily "remove" the read preference for a query.

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            jeromegn Jerome Gravel-Niquet
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: