Skip to content

Commit 44b21c3

Browse files
kevinAlbskay-kim
authored andcommitted
DOCS-10808 fix oplog resize instructions on mmap
1 parent 919dacf commit 44b21c3

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

source/tutorial/change-oplog-size.txt

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ members of your replica set. For example, to shut down, use the
6262

6363
.. code-block:: sh
6464

65+
use admin
6566
db.shutdownServer()
6667

6768
Restart this :program:`mongod` as a standalone instance
@@ -110,15 +111,20 @@ collection:
110111

111112
db.temp.drop()
112113

113-
Use the :method:`db.collection.save()` method and a sort on
114-
reverse :term:`natural order` to find the last entry and save it
115-
to a temporary collection:
114+
Retrieve the latest oplog entry by sorting on reverse :term:`natural order`.
115+
Modify the entry to set ``op`` to "n" (representing a no-op) and clear the
116+
``o`` and ``o2`` fields. Then insert the modified oplog entry into a temporary
117+
collection.
116118

117119
.. _last-oplog-entry:
118120

119121
.. code-block:: javascript
120122

121-
db.temp.save( db.oplog.rs.find( { }, { ts: 1, h: 1 } ).sort( {$natural : -1} ).limit(1).next() )
123+
var oplogEntry = db.oplog.rs.find().sort({$natural: -1}).limit(1).next();
124+
oplogEntry.op = 'n'; // Change the entry to a no-op.
125+
oplogEntry.o = {}; // Remove any update modifiers that would prevent saving the oplog entry to a normal collection.
126+
oplogEntry.o2 = {};
127+
db.temp.insert(oplogEntry);
122128

123129
To see this oplog entry, use the following operation:
124130

@@ -159,12 +165,12 @@ Upon success, this command returns the following status:
159165
Insert the Last Entry of the Old Oplog into the New Oplog
160166
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
161167

162-
Insert the previously saved last entry from the old oplog into the
163-
new oplog. For example:
168+
Insert the previously inserted latest entry from the old oplog into the new
169+
oplog. For example:
164170

165171
.. code-block:: javascript
166172

167-
db.oplog.rs.save( db.temp.findOne() )
173+
db.oplog.rs.insert( db.temp.findOne() )
168174

169175
To confirm the entry is in the new oplog, use the following operation:
170176

0 commit comments

Comments
 (0)