Skip to content

DOCS-4851 #2379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions source/includes/apiargs-method-rs.stepDown-param.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
arg_name: param
description: |
The number of seconds to step down the primary, during which time the
stepdown member is ineligible from becoming primary. If this
parameter is unspecified, the method uses the default value of 60
seconds.
source:
file: apiargs-command-replSetStepDown-field.yaml
ref: replSetStepDown
interface: method
name: seconds
name: stepDownSecs
operation: rs.stepDown
optional: true
position: 1
type: number
---
arg_name: param
source:
file: apiargs-command-replSetStepDown-field.yaml
ref: secondaryCatchUpPeriodSecs
description: |
The number of seconds that ``mongod`` will wait for an
electable secondary to catch up to the primary.

When specified, ``secondaryCatchUpPeriodSecs``
overrides the default wait time of ``10`` seconds.
interface: method
operation: rs.stepDown
position: 2
...
25 changes: 15 additions & 10 deletions source/reference/method/rs.stepDown.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ rs.stepDown()
Description
-----------

.. method:: rs.stepDown(seconds)
.. method:: rs.stepDown(stepDownSecs, secondaryCatchUpPeriodSecs)

Forces the :term:`primary` of the replica set to become a
:term:`secondary`, triggering an :ref:`election for primary
Expand All @@ -23,7 +23,7 @@ Description
The method is only valid against the primary and will error if run
on a non-primary member.

The :method:`rs.stepDown()` method has the following parameter:
The :method:`rs.stepDown()` method has the following parameters:

.. include:: /includes/apiargs/method-rs.stepDown-param.rst

Expand All @@ -40,18 +40,23 @@ terminate long running user operations that would block the primary
from stepping down, such as an index build, a write operation or a
map-reduce job.

To avoid rollbacks, :method:`rs.stepDown()` only steps down the primary
if an electable secondary is completely caught up with the primary. The
method will wait up to the ``10`` seconds for a secondary to catch up.
To avoid rollbacks, :method:`rs.stepDown()`, by default, only
steps down the primary if an electable secondary is completely caught up
with the primary. The command will wait up to either 10 seconds or the
``secondaryCatchUpPeriodSecs`` for a secondary to catch up.

If no electable secondary meets this criterion by the waiting period,
the primary does not step down and the method throws an exception.

If the :method:`rs.stepDown()` completes successfully, the method
forces all clients currently connected to the database to disconnect.
This helps ensure that the clients maintain an accurate view of the
replica set. The :program:`mongo` shell will display an error related
to the disconnect.
Upon successful stepdown, :method:`rs.stepDown()` forces all
clients currently connected to the database to disconnect. This helps
ensure that the clients maintain an accurate view of the replica set.

Because the disconnect includes the connection used to run the command,
you cannot retrieve the return status of the command if the command
completes successfully; i.e. you can only retrieve the return status of
the command if it errors. When running the command in a script, the
script should account for this behavior.

.. note::

Expand Down