@@ -18,10 +18,12 @@ troubleshooting and for further understanding MongoDB's behavior and approach.
18
18
Oplog
19
19
-----
20
20
21
- Under normal operation, MongoDB updates the :ref:`oplog <replica-set-oplog-sizing>`
22
- on a :term:`secondary` within one second of
23
- applying an operation to a :term:`primary`. However, various exceptional
24
- situations may cause a secondary to lag further behind. See
21
+ For an explanation of the oplog, see the :ref:`oplog <replica-set-oplog-sizing>`
22
+ topic in the :doc:`/core/replication` document.
23
+
24
+ Under various exceptional
25
+ situations, updates to a :term:`secondary's <secondary>` oplog might
26
+ lag behind the desired performance time. See
25
27
:ref:`Replication Lag <replica-set-replication-lag>` for details.
26
28
27
29
All members of a :term:`replica set` send heartbeats (pings) to all
@@ -69,65 +71,6 @@ secondaries may not always reflect the latest writes to the
69
71
output to asses the current state of replication and determine if
70
72
there is any unintended replication delay.
71
73
72
- Write Concern and getLastError
73
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
74
-
75
- A write is committed once it has replicated to a majority of members of
76
- the set. For important writes, the client should request acknowledgement
77
- of this with :dbcommand:`getLastError` set to ``w`` to get confirmation
78
- the commit has finished. For more information on
79
- :dbcommand:`getLastError`, see :doc:`/applications/replication`.
80
-
81
- .. TODO Verify if the following info is needed. -BG
82
-
83
- Queries in MongoDB and replica sets have "READ UNCOMMITTED"
84
- semantics. Writes which are committed at the primary of the set may
85
- be visible before the cluster-wide commit completes.
86
-
87
- The read uncommitted semantics (an option on many databases) are more
88
- relaxed and make theoretically achievable performance and
89
- availability higher (for example we never have an object locked in
90
- the server where the locking is dependent on network performance).
91
-
92
- Write Concern and Failover
93
- ~~~~~~~~~~~~~~~~~~~~~~~~~~
94
-
95
- On a failover, if there are writes which have not replicated from the
96
- :term:`primary`, the writes are rolled back. Therefore, to confirm replica-set-wide commits,
97
- use the :dbcommand:`getLastError` command.
98
-
99
- On a failover, data is backed up to files in the rollback directory. To
100
- recover this data use the :program:`mongorestore`.
101
-
102
- .. TODO Verify whether to include the following. -BG
103
-
104
- Merging back old operations later, after another member has accepted
105
- writes, is a hard problem. One then has multi-master replication,
106
- with potential for conflicting writes. Typically that is handled in
107
- other products by manual version reconciliation code by developers.
108
- We think that is too much work : we want MongoDB usage to be less
109
- developer work, not more. Multi-master also can make atomic operation
110
- semantics problematic.
111
-
112
- It is possible (as mentioned above) to manually recover these events,
113
- via manual DBA effort, but we believe in large system with many, many
114
- members that such efforts become impractical.
115
-
116
- Some drivers support 'safe' write modes for critical writes. For
117
- example via setWriteConcern in the Java driver.
118
-
119
- Additionally, defaults for { w : ... } parameter to getLastError can
120
- be set in the replica set's configuration.
121
-
122
- ..note::
123
-
124
- Calling :dbcommand:`getLastError` causes the client to wait for a
125
- response from the server. This can slow the client's throughput on
126
- writes if large numbers are made because of the client/server network
127
- turnaround times. Thus for "non-critical" writes it often makes sense
128
- to make no :dbcommand:`getLastError` check at all, or only a single
129
- check after many writes.
130
-
131
74
.. _replica-set-member-configurations-internals:
132
75
133
76
Member Configurations
@@ -271,21 +214,15 @@ aware of the following conditions and possible situations:
271
214
Elections and Network Partitions
272
215
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
273
216
274
- A replica set has at most one primary at a given time. If a majority of
275
- the set is up, the most up-to-date secondary will be elected primary. If
276
- a majority of the set is not up or reachable, no member will be elected
277
- primary.
278
-
279
- There is no way to tell (from the set's point of view) the difference
280
- between a network partition and members going down, so members left in a
281
- minority will not attempt to become primary (to prevent a set from
282
- ending up with primaries on either side of a partition).
283
-
284
- This means that, if there is no majority on either side of a network
285
- partition, the set will be read only. Thus, we suggest an odd number of
286
- servers: e.g., two servers in one data center and one in another. The
287
- upshot of this strategy is that data is consistent: there are no
288
- multi-primary conflicts to resolve.
217
+ .. TODO The following two paragraphs needs review -BG
218
+
219
+ Members on either side of a network partition cannot see each other when
220
+ determining whether a majority is available to hold an election.
221
+
222
+ That means that if a primary steps down and neither side of the
223
+ partition has a majority on its own, the set will not elect a new
224
+ primary and the set will become read only. The best practice is to have
225
+ and a majority of servers in one data center and one server in another.
289
226
290
227
Syncing
291
228
-------
0 commit comments