Skip to content

Commit d3d299b

Browse files
kchodorowSam Kleinman
authored andcommitted
comments on replication docs
1 parent f9c08e5 commit d3d299b

File tree

8 files changed

+79
-0
lines changed

8 files changed

+79
-0
lines changed

source/administration/replica-sets.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,32 @@ From to time, you may need to add an additional member to an existing
4040
replication process before the member can exit ":term:`recovering`"
4141
status, and become a :term:`secondary` member.
4242

43+
TODO: might be worth mentioning that "you" don't have to copy this data, it's done automatically.
44+
4345
- copy the data directory from an existing member to limit the amount
4446
of time that the recovery process takes.
4547

48+
TODO: if you copy from an existing member, the new member will immediately be a secondary (not recovering).
49+
4650
If the difference in the amount of time between the most recent
4751
operation and the most recent operation to the database exceeds the
4852
length of the :term:`oplog` on the existing members, then the new
4953
instance will have to completely re-synchronize. Ensure that you can
5054
copy the data to the new system and begin replication within the
5155
window allowed by the :term:`oplog`.
5256

57+
TODO: maybe mention you can do this with the db.printReplicationInfo() function.
58+
5359
To add a member to an existing :term:`replica set`, deploy a new
5460
:program:`mongod` instance, specifying the name of the replica set
5561
(i.e. "setname" or ``replSet``) on the command line with the
5662
:option:`--replSet <mongod --replSet>` option or in the configuration
5763
with the :setting:`replSet`. Take note of the host name and
5864
port information for the new :program:`mongod` instance.
5965

66+
TODO: "the configuration
67+
with" -> the configuration file with
68+
6069
Then, log in to the current primary using the :program:`mongo`
6170
shell. Issue the :func:`db.isMaster()` command when connected to *any*
6271
member of the set to determine the current :term:`primary`. Issue the
@@ -73,6 +82,8 @@ of the fields in a :data:`members` document, for example:
7382
7483
rs.add({host: "mongo2.example.net:27017", priority: 0, hidden: true})
7584
85+
TODO: is the _id field automatically populated?
86+
7687
This configures a :term:`hidden member` that is accessible at
7788
``mongo2.example.net:27018``. See ":data:`host <members[n].host>`,"
7889
":data:`priority <members[n].priority>`," and ":data:`hidden
@@ -123,6 +134,8 @@ in the :program:`mongo` shell:
123134
rs.remove("mongo2.example.net:27018")
124135
rs.add({host: "mongo2.example.net:27019", priority: 0, hidden: true})
125136
137+
TODO: prior to 2.2, this will almost never work because the _id will change.
138+
126139
Second, you may consider using the following procedure to use
127140
:func:`rs.reconfig()` to change the value of the
128141
:data:`members[n].host` field to reflect the new hostname or port
@@ -284,6 +297,8 @@ the :program:`mongo` shell to modify node priorities:
284297
cfg.members[3].priority = 2
285298
rs.reconfig(cfg)
286299
300+
TODO: this is actually 4 nodes...
301+
287302
This operation sets the member ``0`` to ``0`` and cannot become
288303
primary. Member ``3`` has a priority of ``2`` and will become primary,
289304
if eligible, under most circumstances. Member ``2`` has a priority of
@@ -320,6 +335,10 @@ operations in the :program:`mongo` shell:
320335
cfg.members[0].hidden = true
321336
rs.reconfig(cfg)
322337
338+
TODO: it might be worth noting that, currently, you must send the reconfig command to
339+
a member that can become primary in the new configuration. So, if members[0] is the
340+
current primary, this reconfig won't work.
341+
323342
After re-configuring the set, the node with the "``_id``" of ``0``,
324343
has a priority of ``0`` so that it cannot become master, while the
325344
other nodes in the set will not advertise the hidden node in the
@@ -519,4 +538,6 @@ data to a :term:`BSON`.
519538
You can prevent Rollbacks prevented by ensuring safe writes by using
520539
the appropriate :term:`write concern`.
521540

541+
TODO: "rollback" is not a proper noun.
542+
522543
.. seealso:: ":ref:`Replica Set Elections <replica-set-elections>`"

source/administration/replication-architectures.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ of replica sets may be its greatest strenght. This document outlines
1010
and describes the most prevalent deployment patterns for replica set
1111
administrators.
1212

13+
TODO: strenght?
14+
1315
.. seealso:: ":doc:`/administration/replica-sets`" and
1416
":doc:`/reference/replica-configuration`."
1517

@@ -65,6 +67,8 @@ architectural conditions are true:
6567

6668
- A majority *of the set's* members exist in the main data center.
6769

70+
TODO: I don't understand why "of the set's" is emphasized.
71+
6872
.. seealso:: ":doc:`/tutorial/expand-replica-set`."
6973

7074
.. _replica-set-geographical-distribution:
@@ -138,6 +142,8 @@ settings relevant for these kinds of nodes:
138142
of votes, if you need to have more than 7 members of a replica
139143
set. (:ref:`see also <replica-set-non-voting-members>`.)
140144

145+
TODO: and the potential... for royally screwing yourself.
146+
141147
Backups
142148
~~~~~~~
143149

@@ -149,6 +155,9 @@ perspective, to the primary node or likely primary, and that the
149155
create a dedicated :ref:`hidden node <replica-set-hidden-members>` for
150156
the purpose of creating backups.
151157

158+
TODO: Glitch in the matrix: "a replica set member for dedicated
159+
backup for dedicated backup purposes"
160+
152161
If this node have journaling enabled, you can safely use standard
153162
:ref:`block level backup methods <block-level-backup>` to create a
154163
backup of this node. Otherwise, if your underlying system does not

source/applications/replication.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ replica set configuration. For instance:
6868
cfg.settings.getLastErrorDefaults = "w: majority, fsync: false, j: true"
6969
rs.reconfig(cfg)
7070
71+
TODO: Incorrect getLastErrorDefaults setting:
72+
cfg.settings.getLastErrorDefaults = {w: "majority", fsync: false, j: true}
73+
74+
7175
When the new configuration is active, the effect of the
7276
:dbcommand:`getLastError` operation will wait until the write
7377
operation has succeeded on a majority of the nodes before writing. By

source/core/replication-internals.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ exceptional situations may cause secondaries lag behind further. See
3030
All nodes send heartbeats to all other nodes, and will import
3131
operations into its oplog from the node with the lowest "ping" time.
3232

33+
TODO: the lowest "ping" time thing is very specific to 2.0, it wasn't true in 1.8 and probably will be different again in 2.2. Not sure if you care or not.
34+
3335
.. _replica-set-implementation:
3436

3537
Implementation
@@ -48,6 +50,8 @@ section for more about ":ref:`read preference
4850
<replica-set-read-preference>`" and ":ref:`write concern
4951
<replica-set-write-concern>`."
5052

53+
TODO: "However, clients possible..."
54+
5155
.. note::
5256

5357
Use :func:`db.getReplicationInfo()` from a secondary node
@@ -115,6 +119,8 @@ looses contact with a :term:`primary` node. All members have one vote
115119
in an election, and every :program:`mongod` can veto an election. A
116120
single member's veto will invalidate the election.
117121

122+
TODO: sp: looses
123+
118124
An existing primary will step down in response to the
119125
:dbcommand:`replSetStepDown` command, or if it sees that one of
120126
the current secondaries is eligible for election *and* has a higher

source/core/replication.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ ensure high availability, simplifies certain administrative tasks
1818
such as backups, and may increase read capacity. Most production
1919
deployments are or should use replication.
2020

21+
TODO: "are or should use replication." are use replication?
22+
2123
If you're familiar with other database systems, you may think about
2224
replica sets as a more sophisticated form of traditional master-slave replication. [#master-slave]_
2325
In master-slave replication, a ":term:`master`" node accepts writes while one or more
@@ -196,6 +198,8 @@ remain a secondary.
196198
all client connections. This ensures that the clients maintain an accurate
197199
view of the :term:`replica set` and helps prevent :term:`rollbacks <rollback>`.
198200

201+
TODO: it's actually just when a primary steps down that connections are closed.
202+
199203
.. seealso:: ":ref:`Replica Set Election Internals <replica-set-election-internals>`"
200204

201205
.. _replica-set-node-priority:
@@ -261,6 +265,14 @@ secondary those operations the former primary must revert these
261265
operations or "rolled back" these operations to maintain database
262266
consistency across the replica set.
263267

268+
TODO: ":term:`primary` nodes will have
269+
accepted write operations that have replicated to the
270+
:term:`secondaries <secondary>`" -> have not replicated to the secondary
271+
272+
TODO: "as a
273+
secondary those operations the former primary must revert these
274+
operations or" those operations...these operations
275+
264276
MongoDB writes the rollback data to a :term:`BSON` file in the
265277
database's :setting:`dbpath` directory. Use :doc:`bsondump
266278
</reference/bsondump>` to read the contents of these rollback files
@@ -271,6 +283,9 @@ administrator's direct intervention, users should strive to avoid
271283
rollbacks as much as possible. Until an administrator applies this
272284
rollback data, the former primary remains in a "rollback" status.
273285

286+
TODO: "Until an administrator applies this
287+
rollback data, the former primary remains in a "rollback" status." Untrue! ROLLBACK state should automatically correct itself and the server will end up in SECONDARY state.
288+
274289
The best strategy for avoiding all rollbacks is to ensure :ref:`write
275290
propagation <replica-set-write-concern>` to all or some of the
276291
nodes in the set. Using these kinds of policies prevents situations
@@ -289,6 +304,8 @@ that might create rollbacks.
289304
data and restarts the :program:`mongod` instance. Only then can the
290305
node becomes a normal :term:`secondary` terms.
291306

307+
TODO: not true...
308+
292309
Application Concerns
293310
~~~~~~~~~~~~~~~~~~~~
294311

@@ -442,6 +459,8 @@ the existing members.
442459
and the database may remain in an inconsistent state and
443460
unrecoverable state.
444461

462+
TODO: this isn't true. If you are running w/out journaling and mongod terminates "ungracefully" you can lose _all_ data. Also, you should assume, after a crash w/out journaling, that the db is in an inconsistent (i.e., corrupt) state.
463+
445464
**Use journaling**, however, do not forego proper replication
446465
because of journaling.
447466

source/reference/replica-configuration.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ Configuration Variables
5757
:data:`members[n].host` cannot hold a value that
5858
resolves to ``localhost`` or the local interface.
5959

60+
TODO: unless all of the members in the set do. You can have all-or-none localhost.
61+
6062
.. data:: members[n].arbiterOnly
6163

6264
*Optional*.
@@ -81,6 +83,9 @@ Configuration Variables
8183
become a master, or if any clients ever issue queries against this
8284
instance.
8385

86+
TODO: whether, not weather
87+
Probably "Do not set to false if a member *can* become a master..."
88+
8489
Omitting index creation, and thus this setting, may be useful,
8590
**if**:
8691

source/reference/replica-status.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ in heartbeats sent to the current instance by other members of the
1818
replica set: because of the frequency of heartbeats, these data can be
1919
at most 2 seconds out of date.
2020

21+
TODO: not sure I'd commit to 2 seconds, as the timeout before heartbeat fails is ~20 seconds. So maybe "this data can be a few seconds out-of-date"?
22+
2123
.. note::
2224

2325
The :program:`mongod` that you issue the :dbcommand:`replSetGetStatus`
@@ -38,6 +40,8 @@ Statuses
3840
The ``set`` value is the name of the replica set, configured in the
3941
:setting:`replSet` setting.
4042

43+
TODO: might want to mention it's the same as the _id in rs.conf(), but no one's ever expressed confusion about that, so minor point.
44+
4145
.. status:: rs.status.date
4246

4347
The value of the ``date`` field is an :term:`ISODate` of the
@@ -53,6 +57,8 @@ Statuses
5357
the state of the member. These integers map to states, as described
5458
in the following table:
5559

60+
TODO: an integer between 0 and 10, now.
61+
5662
========== ==========================================================
5763
**Number** **State**
5864
---------- ----------------------------------------------------------
@@ -76,6 +82,8 @@ Statuses
7682
<repl-set-member-statuses>`" for an overview of the values included
7783
in these documents.
7884

85+
TODO: this is missing the syncedTo field, only present on secondaries (and recovering nodes) that shows who they're syncing from.
86+
7987
.. _repl-set-member-statuses:
8088

8189
Member Statuses
@@ -121,12 +129,16 @@ Member Statuses
121129
A 64-bit timestamp of the last operation applied to this member
122130
of the replica set from the :term:`oplog`.
123131

132+
TODO: 32-bit (t+i=64-bit)
133+
124134
.. status:: members.optime.i
125135

126136
An incremented field, which reflects the number of operations in
127137
since the last time stamp. This value only increases if there
128138
are more than one operation per second.
129139

140+
TODO: ...if there is more
141+
130142
.. status:: members[n].optimeDate
131143

132144
An :term:`ISODate` formatted date string that reflects the last

source/reference/replication-info.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ The following fields appear in the output of
7373
Returns a time stamp for the first (i.e. earliest) operation in the
7474
:term:`oplog`. Compare this value to :status:`now`.
7575

76+
TODO: copypasta with tFirst
77+
Also, please don't encourage people to compare this with "now", they should compare it to the last time they did a write. tLast could be days ago, but if there haven't been any writes since, lag is 0.
78+
7679
.. status:: now
7780

7881
Returns a time stamp reflecting the current time. The shell process

0 commit comments

Comments
 (0)