-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
I am running a map reduce on a replica set with Mongoid3 and get "failed with error "not master" when my db config is set to consistency :eventual.
Dug into the moped gem a bit and I see that on reads it's yielding to the secondary node, which is fine but my map reduce then needs to write to primary.
I included the moped method as well as my stack trace. I'm going to temporarily fix this on my end but it would be great if this gets patched. Thanks a lot.
gems/moped-1.1.3/lib/moped/session/context.rb
def with_node
if consistency == :eventual
cluster.with_secondary do |node|
yield node
end
else
cluster.with_primary do |node|
yield node
end
end
end
failed with error "not master"
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/moped-1.1.3/lib/moped/node.rb:74:in `block in command'
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/moped-1.1.3/lib/moped/node.rb:522:in `[]'
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/moped-1.1.3/lib/moped/node.rb:522:in `block (3 levels) in flush'
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/moped-1.1.3/lib/moped/node.rb:521:in `map'
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/moped-1.1.3/lib/moped/node.rb:521:in `block (2 levels) in flush'
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/moped-1.1.3/lib/moped/node.rb:113:in `ensure_connected'
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/moped-1.1.3/lib/moped/node.rb:517:in `block in flush'
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/moped-1.1.3/lib/moped/node.rb:532:in `logging'
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/moped-1.1.3/lib/moped/node.rb:516:in `flush'
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/moped-1.1.3/lib/moped/node.rb:505:in `process'
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/moped-1.1.3/lib/moped/node.rb:70:in `command'
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/moped-1.1.3/lib/moped/session/context.rb:51:in `block in command'
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/moped-1.1.3/lib/moped/session/context.rb:105:in `block in with_node'
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/moped-1.1.3/lib/moped/cluster.rb:180:in `with_secondary'
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/moped-1.1.3/lib/moped/session/context.rb:104:in `with_node'
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/moped-1.1.3/lib/moped/session/context.rb:50:in `command'
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/moped-1.1.3/lib/moped/database.rb:76:in `command'
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/moped-1.1.3/lib/moped/session.rb:78:in `command'
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/mongoid-3.0.1/lib/mongoid/contextual/map_reduce.rb:269:in `results'
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/mongoid-3.0.1/lib/mongoid/contextual/map_reduce.rb:239:in `documents'
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/mongoid-3.0.1/lib/mongoid/contextual/map_reduce.rb:36:in `each'
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/mongoid-3.0.1/lib/mongoid/contextual/map_reduce.rb:9:in `entries'
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/mongoid-3.0.1/lib/mongoid/contextual/map_reduce.rb:9:in `inspect'
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/railties-3.2.6/lib/rails/commands/console.rb:47:in `start'
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/railties-3.2.6/lib/rails/commands/console.rb:8:in `start'
from /Users/E/.rvm/gems/ruby-1.9.3-p194@wtest/gems/railties-3.2.6/lib/rails/commands.rb:41:in `<top (required)>'