Skip to content

Commit 8aa791e

Browse files
committed
minor: docs
1 parent 78dd503 commit 8aa791e

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

docs/REPLICA_SETS.md

+13-4
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,24 @@ Imagine that either the master node or one of the read nodes goes offline. How w
2828

2929
If any read operation fails, the driver will raise a *ConnectionFailure* exception. It then becomes the client's responsibility to decide how to handle this.
3030

31-
If the client decides to retry, it's not guaranteed that another member of the replica set will have been promoted to master right away, so it's still possible that the driver will raise another *ConnectionFailure*. However, once a member has been promoted to master, typically within a few seconds, subsequent operations will succeed.
31+
If the client decides to retry, it's not guaranteed that another member of the replica set will have been promoted to master right away, so it's still possible that the driver will raise another *ConnectionFailure*. However, once a member has been promoted to master, typically within a few seconds, subsequent operations will succeed. *Note that this does not prevent
32+
exception in the event of a primary failover.*
3233

3334
The driver will essentially cycle through all known seed addresses until a node identifies itself as master.
3435

3536
### Refresh mode
3637

3738
You can now specify a refresh mode and refresh interval for a replica set connection. This will help to ensure that
38-
changes to a replica set's configuration are quickly reflected on the driver side. Refresh mode is
39-
enabled in synchronous mode by default. Here's how to specify this explicitly:
39+
changes to a replica set's configuration are quickly reflected on the driver side. In particular, if you change
40+
the state of any secondary node, the automated refresh will ensure that this state is recorded on the client side.
41+
If you add a secondary that responds to pings much faster than the existing nodes, then the new secondary will
42+
be used for reads.
43+
44+
Refresh mode is enabled in synchronous mode by default. This is the recommended setting, but here's how to specify this explicitly:
4045

4146
@connection = ReplSetConnection.new(['n1.mydb.net', 27017], :refresh_mode => :sync)
4247

43-
If you want to refresh to happen via a background thread, use the `:async` mode. NOTE: the background
48+
If you want to refresh via a background thread, use the `:async` mode. NOTE: the background
4449
version may be more effective on platforms that use native threads, such as JRuby:
4550

4651
@connection = ReplSetConnection.new(['n1.mydb.net', 27017], :refresh_mode => :async)
@@ -56,6 +61,10 @@ You can also disable refresh mode altogether:
5661

5762
@connection = ReplSetConnection.new(['n1.mydb.net', 27017], :refresh_mode => false)
5863

64+
And you can call `refresh` manually on any replica set connection:
65+
66+
@connection.refresh
67+
5968
### Recovery
6069

6170
Driver users may wish to wrap their database calls with failure recovery code. Here's one possibility, which will attempt to connection

0 commit comments

Comments
 (0)