-
Type:
Bug
-
Resolution: Done
-
Priority:
Minor - P4
-
Affects Version/s: 1.6
-
Component/s: None
-
None
-
Environment:Windows 2008 R2
-
None
-
None
-
None
-
None
-
None
-
None
-
None
UPDATE:
The code base currently takes primary ping times into consideration when using a secondary preferred read preference, which causes the below issue. In addition, we plan to make the acceptable latency (currently at 15ms) configurable.
ORIGINAL:
I have 3 Amazon EC2 instances setup. Machine A runs Windows 2008 R2 using the 1.6 C# Driver. The Mongo systems are running on Ubuntu 12.
Machine A: web site (US-West zone)
Machine B: Mongo 2.2.0 primary (US-West zone)
Machine C: Mongo 2.2.0 secondary (US-East zone)
The only way I'm able to get queries to connect to the secondary, is if I set the readPreference to secondary. Setting to secondaryPreferred always picks the primary so my primary gets overloaded and the secondary is never used.
The bug seems to come from MultipleInstanceMongoServerProxy.Connect(). When ConnectInstance is called, it starts connections to both servers. The primary connects right away, but since this function only sleeps for 20 milliseconds, the secondary (in another amazon zone) doesn't get a chance to finish completing by the time the loops runs again. So ChooseServerInstance gets called with only the primary connected, so the secondary is not in the list by the time ReadPreference.ChooseServerInstanec is called.
I saw this behavior happen in the debugger.