diff --git a/source/reference/command/replSetResizeOplog.txt b/source/reference/command/replSetResizeOplog.txt index 0f0cde4efa1..a5d32474eaa 100644 --- a/source/reference/command/replSetResizeOplog.txt +++ b/source/reference/command/replSetResizeOplog.txt @@ -15,17 +15,16 @@ Definition .. dbcommand:: replSetResizeOplog - .. versionadded:: 3.6 - - Use the :dbcommand:`replSetResizeOplog` administrative command to - change the size of a replica set member's oplog. [#oplog]_ - - .. versionadded:: 4.4 :dbcommand:`replSetResizeOplog` also supports specifying the minimum number of hours to preserve an oplog entry. + .. versionchanged:: 5.0 + + To set the ``replSetOplog`` size in :binary:`~bin.mongosh`, use + the ``Double()`` constructor. + :dbcommand:`replSetResizeOplog` enables you to resize the oplog or its minimum retention period dynamically without restarting the :binary:`~bin.mongod` process. @@ -72,6 +71,10 @@ Definition - The maximum size you can specify is 1 petabytes. + - Explicitly cast the ``size`` as a double in + :binary:`~bin.mongosh` with ``Double()``. See + :ref:`oplog-ex-change-size`. + * - :ref:`minRetentionHours ` - double @@ -119,6 +122,8 @@ You can only use :dbcommand:`replSetResizeOplog` on See the :ref:`tutorial-change-oplog-size` tutorial for a procedure on using :dbcommand:`replSetResizeOplog` command to resize the oplog. +.. include:: /includes/fact-oplog-size.rst + Starting in MongoDB 4.0, MongoDB forbids dropping the ``local.oplog.rs`` collection. For more information on this restriction, see :ref:`oplog-coll-behavior`. @@ -227,6 +232,8 @@ For more information on locking in MongoDB, see :doc:`/faq/concurrency`. Examples -------- +.. _oplog-ex-change-size: + Change the Maximum Oplog Size ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -249,7 +256,7 @@ oplog size of this member to 16384 megabytes: .. code-block:: javascript - db.adminCommand({ "replSetResizeOplog": 1, size: 16384}) + db.adminCommand({ "replSetResizeOplog": 1, size: Double(16384)}) To verify the new oplog size, rerun the :method:`db.collection.stats()` method: @@ -269,9 +276,6 @@ The above command returns: may cause replica members syncing with that node to become stale. To resync those members, see :doc:`/tutorial/resync-replica-set-member`. -.. [#oplog] - - .. include:: /includes/fact-oplog-size.rst Change the Minimum Oplog Retention Period ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/source/release-notes/5.0-compatibility.txt b/source/release-notes/5.0-compatibility.txt index 41d032dca77..c7d9ec95b92 100644 --- a/source/release-notes/5.0-compatibility.txt +++ b/source/release-notes/5.0-compatibility.txt @@ -382,6 +382,9 @@ Starting in MongoDB 5.0: default write concern. To set the global default write concern, use the :dbcommand:`setDefaultRWConcern` command. +- To set the ``replSetOplog`` size in :binary:`~bin.mongosh`, use the + ``Double()`` constructor with the :dbcommand:`replSetResizeOplog` + command. Deprecations ~~~~~~~~~~~~ diff --git a/source/tutorial/change-oplog-size.txt b/source/tutorial/change-oplog-size.txt index 36523f67e50..cd480a95a65 100644 --- a/source/tutorial/change-oplog-size.txt +++ b/source/tutorial/change-oplog-size.txt @@ -69,16 +69,17 @@ The ``maxSize`` field displays the collection size in bytes. C. Change the oplog size of the replica set member -------------------------------------------------- -To resize the oplog, run the :dbcommand:`replSetResizeOplog` command, -passing the desired size in megabytes as the ``size`` parameter. The -specified size must be greater than ``990``, or 990 megabytes. +Resize the oplog with the :dbcommand:`replSetResizeOplog` command. The +``size`` is a double and must be greater than ``990`` megabytes. To +explicitly cast the oplog ``size`` in :binary:`~bin.mongosh`, use the +``Double()`` constructor. The following operation changes the oplog size of the replica set member to 16 gigabytes, or 16000 megabytes. .. code-block:: javascript - db.adminCommand({replSetResizeOplog: 1, size: 16000}) + db.adminCommand({replSetResizeOplog: 1, size: Double(16000)}) .. [#oplog]