-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
Affects Version/s: 2.0.0
-
Component/s: None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
With a standalone client, execution of a command gets rerouted incorrectly. The following patch shows uses a hack to bypass this for test code. This is obviously not a possible solution, just illustration of the problem that cannot be solved easily as the data to fix this is not available.
module Operation
class Command
# global $reroute is just a hack to bypass rerouting for a client with mode standalone
def execute(context)
# @todo: Should we respect tag sets and options here?
if $reroute
if context.server.secondary? && !secondary_ok?
warn "Database command '#{selector.keys.first}' rerouted to primary server"
context = Mongo::ServerPreference.get(:mode => :primary).server.context
end
end
execute_message(context)
end
end
end