Skip to content

Commit 686b94e

Browse files
committed
DOCS-13894 forbid manual writes to oplog when replset
1 parent d527521 commit 686b94e

File tree

3 files changed

+22
-90
lines changed

3 files changed

+22
-90
lines changed

source/core/replica-set-oplog.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,3 +218,10 @@ set member. This restriction applies to both single-member and
218218
multi-member replica sets. Dropping the oplog can lead to data
219219
inconsistencies in the replica set if a node temporarily
220220
goes down and attempts to replay the oplog during the restart process.
221+
222+
Starting in MongoDB 4.0.22, it is no longer possible to perform manual
223+
write operations to the :doc:`oplog </core/replica-set-oplog>` on a
224+
cluster running as a :ref:`replica set <replication>`. Performing write
225+
operations to the oplog when running as a
226+
:term:`standalone instance <standalone>` should only be done with
227+
guidance from MongoDB Support.

source/reference/local-database.txt

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ stores data used in the replication process and other
2525
instance-specific data. The ``local`` database is invisible to
2626
replication: collections in the ``local`` database are not replicated.
2727

28-
Collection on all ``mongod`` Instances
29-
--------------------------------------
28+
Collections on all ``mongod`` Instances
29+
---------------------------------------
3030

3131
.. data:: local.startup_log
3232

@@ -117,14 +117,19 @@ Collections on Replica Set Members
117117

118118
:data:`local.oplog.rs` is the capped collection that holds the
119119
:term:`oplog`. You set its size at creation using the
120-
:setting:`~replication.oplogSizeMB` setting. To resize the oplog after replica set
121-
initiation, use the :doc:`/tutorial/change-oplog-size`
122-
procedure. For additional information, see the
123-
:ref:`replica-set-oplog-sizing` section.
124-
125-
.. note::
126-
127-
.. include:: /includes/fact-oplog-size.rst
120+
:setting:`~replication.oplogSizeMB` setting. To resize the oplog
121+
after replica set initiation, use the
122+
:doc:`/tutorial/change-oplog-size` procedure. For additional
123+
information, see the :ref:`replica-set-oplog-sizing` section.
124+
125+
.. include:: /includes/fact-oplog-size.rst
126+
127+
Starting in MongoDB 4.0.22, it is no longer possible to perform
128+
manual write operations to the :doc:`oplog </core/replica-set-oplog>`
129+
on a cluster running as a :ref:`replica set <replication>`.
130+
Performing write operations to the oplog when running as a
131+
:term:`standalone instance <standalone>` should only be done with
132+
guidance from MongoDB Support.
128133

129134
.. data:: local.replset.minvalid
130135

source/tutorial/troubleshoot-replica-sets.txt

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -275,83 +275,3 @@ tutorial.
275275
.. [#oplog]
276276

277277
.. include:: /includes/fact-oplog-size.rst
278-
279-
Oplog Entry Timestamp Error
280-
---------------------------
281-
282-
.. todo:: link assertion 13290 here once assertion guide exists.
283-
284-
Consider the following error in :binary:`~bin.mongod` output and logs:
285-
286-
.. code-block:: javascript
287-
288-
replSet error fatal couldn't query the local local.oplog.rs collection. Terminating mongod after 30 seconds.
289-
<timestamp> [rsStart] bad replSet oplog entry?
290-
291-
Often, an incorrectly typed value in the ``ts`` field in the last
292-
:term:`oplog` entry causes this error. The correct data type is
293-
Timestamp.
294-
295-
Check the type of the ``ts`` value using the following two queries
296-
against the oplog collection:
297-
298-
.. code-block:: javascript
299-
300-
db = db.getSiblingDB("local")
301-
db.oplog.rs.find().sort({$natural:-1}).limit(1)
302-
db.oplog.rs.find({ts:{$type:17}}).sort({$natural:-1}).limit(1)
303-
304-
The first query returns the last document in the oplog, while the
305-
second returns the last document in the oplog where the ``ts`` value
306-
is a Timestamp. The :query:`$type` operator allows you to select
307-
:term:`BSON type <BSON types>` 17, is the Timestamp data type.
308-
309-
If the queries don't return the same document, then the last document in
310-
the oplog has the wrong data type in the ``ts`` field.
311-
312-
.. example::
313-
314-
If the first query returns this as the last oplog entry:
315-
316-
.. code-block:: javascript
317-
318-
{ "ts" : {t: 1347982456000, i: 1},
319-
"h" : NumberLong("8191276672478122996"),
320-
"op" : "n",
321-
"ns" : "",
322-
"o" : { "msg" : "Reconfig set", "version" : 4 } }
323-
324-
And the second query returns this as the last entry where ``ts``
325-
has the ``Timestamp`` type:
326-
327-
.. code-block:: javascript
328-
329-
{ "ts" : Timestamp(1347982454000, 1),
330-
"h" : NumberLong("6188469075153256465"),
331-
"op" : "n",
332-
"ns" : "",
333-
"o" : { "msg" : "Reconfig set", "version" : 3 } }
334-
335-
Then the value for the ``ts`` field in the last oplog entry is of the
336-
wrong data type.
337-
338-
To set the proper type for this value and resolve this issue,
339-
use an update operation that resembles the following:
340-
341-
.. code-block:: javascript
342-
343-
db.oplog.rs.update( { ts: { t:1347982456000, i:1 } },
344-
{ $set: { ts: new Timestamp(1347982456000, 1)}})
345-
346-
Modify the timestamp values as needed based on your oplog entry. This
347-
operation may take some period to complete because the update must
348-
scan and pull the entire oplog into memory.
349-
350-
Duplicate Key Error on ``local.slaves``
351-
---------------------------------------
352-
353-
.. versionchanged:: 3.0.0
354-
355-
MongoDB 3.0.0 removes the :data:`local.slaves` collection. For
356-
``local.slaves`` error in earlier versions of MongoDB, refer to the
357-
appropriate version of the MongoDB Manual.

0 commit comments

Comments
 (0)