File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -38,8 +38,16 @@ The driver will essentially cycle through all known seed addresses until a node
3838You can now specify a refresh mode and refresh interval for a replica set connection. This will help to ensure that
3939changes to a replica set's configuration are quickly reflected on the driver side. In particular, if you change
4040the state of any secondary node, the automated refresh will ensure that this state is recorded on the client side.
41+
42+ There are two secenarios in which refresh is helpful and does not raise exceptions:
43+
44+ # You add a new secondary node to an existing replica set
45+ # You remove an unused secondary from an existing replica set
46+
47+ If using MongoDB earlier than 2.0 any changes to replica set state will raise exceptions therefore refresh mode will not be useful.
48+
4149If you add a secondary that responds to pings much faster than the existing nodes, then the new secondary will
42- be used for reads.
50+ be used for reads if : read_preference is : secondary or : secondary_only
4351
4452Refresh mode is disabled by default.
4553
Original file line number Diff line number Diff line change @@ -45,8 +45,16 @@ def test_read_write_load_with_added_nodes
4545 end
4646 end
4747
48- @rs . add_node
49- threads . each { |t | t . join }
48+ # MongoDB < 2.0 will disconnect clients on rs.reconfig()
49+ if @rs . version . first < 2
50+ assert_raise Mongo ::ConnectionFailure do
51+ @rs . add_node
52+ threads . each { |t | t . join }
53+ end
54+ else
55+ @rs . add_node
56+ threads . each { |t | t . join }
57+ end
5058
5159 config = @conn [ 'admin' ] . command ( { :ismaster => 1 } )
5260
You can’t perform that action at this time.
0 commit comments