-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Environment:Gentoo Linux amd64
MongoDB 1.8.2
Mongoid 2.0.2
I sent this issue to MongoID github repository. Durran told me it is an issue in the Ruby driver, so I post it here.
Mongoid config:
development:
hosts:
- - foo
- 27017
- - bar
- 27017
read_secondary: true
foo is the primary, bar is secondary, other nodes are hidden.
When I start the application, writes go to foo, reads go to bar. This is fine.
Then I stop mongodb on bar.
Writes go to foo and reads go to foo. Fine.
Then I start mongodn on bar.
Writes should go to foo and reads should go to bar again.
However reads still go to foo. No matter how long I wait after restarting bar.
I have to restart the whole rails application to make mongoid to query bar again for reads.
Mongoid should check resumed slaves periodically.
Note that if I stop foo at this point then both writes and reads go to bar. That is fine.
Only the resumed slaves are not checked to send them read queries again.