Skip to content

DOCS-863 DOCS-975 DOCS-1069 test commands + --setParameter #651

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

Merged
merged 15 commits into from
Feb 23, 2013
Merged
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
7 changes: 7 additions & 0 deletions source/includes/note-enabletestcommands.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.. note::

|dbcommand| is an internal command that is not enabled by default.
|dbcommand| must be enabled by using
:option:`--setParameter enableTestCommands=1 <mongod --setParameter>`
on the :program:`mongod` command line.
|dbcommand| cannot be enabled during run-time.
35 changes: 35 additions & 0 deletions source/reference/command/captrunc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
===================
captrunc (internal)
===================

.. default-domain:: mongodb

.. dbcommand:: captrunc

The :dbcommand:`captrunc` command is an internal command that is used
to truncate capped collections.

:param string collection: the name of the collection to truncate.
:param integer n: a BSON document specifying the number of documents to
remove.
:param Boolean inc: specifies whether to truncate the ``n``th document.

.. example::

Truncate 10 ``older`` documents from the collection :samp:`example`:

.. code-block:: javascript

db.runCommand({captrunc: "example" , n:10})

Truncate 100 documents and the 101st document:

.. code-block:: javascript

db.runCommand({captrunc: "example", n:100, inc:true})

.. |dbcommand| replace:: :dbcommand:`replSetTest`
.. include:: /includes/note-enabletestcommands.rst

.. write-lock
.. testcommand
21 changes: 21 additions & 0 deletions source/reference/command/configureFailPoint.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
=============================
configureFailPoint (internal)
=============================

.. default-domain:: mongodb

.. dbcommand:: configureFailPoint

:dbcommand:`configureFailPoint` is an internal testing command that
configures failure points.

:param string: specifies the name of the failure point.
:param string mode: specifies whether failure point is always on
:samp:`alwaysOn` or :samp:`off`.

:param mode: Specify a document ``{times: n}``
to control the number of times the failure point
is activated.

.. |dbcommand| replace:: :dbcommand:`configureFailPoint`
.. include:: /includes/note-enabletestcommands.rst
9 changes: 6 additions & 3 deletions source/reference/command/emptycapped.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
===========
emptycapped
===========
======================
emptycapped (internal)
======================

.. default-domain:: mongodb

Expand All @@ -20,3 +20,6 @@ emptycapped

This command obtains a write lock on the affected database and
will block other operations until it has completed.

.. |dbcommand| replace:: :dbcommand:`emptycapped`
.. include:: /includes/note-enabletestcommands.rst
4 changes: 4 additions & 0 deletions source/reference/command/godinsert.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ godinsert (internal)
This command obtains a write lock on the affected database and will
block other operations until it has completed.

.. |dbcommand| replace:: :dbcommand:`godinsert`
.. include:: /includes/note-enabletestcommands.rst


.. write-lock, slave-ok
71 changes: 71 additions & 0 deletions source/reference/command/hashBSONElement.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
===========================
_hashBSONElement (internal)
===========================

.. default-domain:: mongodb

.. dbcommand:: _hashBSONElement

.. versionaddded:: 2.3.2

:dbcommand:`_hashBSONElement`
is an internal command that computes the MD5 hash of a BSON element.
Eight (8) bytes are returned from the 16 byte MD5 hash.

:param BSONElement key: specifies the BSON element to hash.

:param integer seed: specifies a seed to use to compute the hash.

:returns: A document consisting of ``key``, ``seed``, ``out``
and ``ok`` fields.

:field BSONType key: the original BSON element.
:field integer seed: the seed used for the hash, defaults to 0.
:field NumberLong out: the decimal result of the hash.
:field integer ok: exit code (1 = ok, 0 = error)


.. |dbcommand| replace:: :dbcommand:`_hashBSONElement`
.. include:: /includes/note-enabletestcommands.rst

.. example::

.. code-block:: sh

mongod --setParameter=enableTestCommands=1

.. example::

Hash an ISODate string:

.. code-block:: javascript

> db.runCommand({_hashBSONElement: ISODate("2013-02-12T22:12:57.211Z")})

Which returns the following document:

.. code-block:: javascript

{
"key" : ISODate("2013-02-12T22:12:57.211Z"),
"seed" : 0,
"out" : NumberLong("-4185544074338741873"),
"ok" : 1
}

Hash the same ISODate string but specify a seed value:

.. code-block:: javascript

> db.runCommand({_hashBSONElement: ISODate("2013-02-12T22:12:57.211Z"), seed:2013})

Which returns the following document:

.. code-block:: javascript

{
"key" : ISODate("2013-02-12T22:12:57.211Z"),
"seed" : 2013,
"out" : NumberLong("7845924651247493302"),
"ok" : 1
}
3 changes: 3 additions & 0 deletions source/reference/command/journalLatencyTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ journalLatencyTest

The value (i.e. ``1`` above), does not affect the operation of the
command.

.. |dbcommand| replace:: :dbcommand:`_journalLatencyTest`
.. include:: /includes/note-enabletestcommands.rst
5 changes: 5 additions & 0 deletions source/reference/command/replSetTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ replSetTest (internal)
:dbcommand:`replSetTest` is internal diagnostic command used for regression
tests that supports replica set functionality.

.. |dbcommand| replace:: :dbcommand:`replSetTest`
.. include:: /includes/note-enabletestcommands.rst


.. slave-ok, admin-only

52 changes: 50 additions & 2 deletions source/reference/command/setParameter.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,54 @@ setParameter
.. seealso::

:setting:`syncdelay`.



:option boolean enableLocalhostAuthBypass:

.. versionadded: 2.4

Specify :samp:`0` to disable localhost authentication bypass.
Enabled by default.

:option boolean logUserIds:

.. versionadded: 2.4

Specify :samp:`1` to enable logging of userids.
Disabled by default.

:option integer replApplyBatchSize:

.. versionadded: 2.4

Specify the number of oplog entries to apply as a single batch.
:option:`replApplyBatchSize` must be an integer from 1 to 1024.
This option may only be specified on a slave machine.
The batch size cannot be greater than ``1`` if setting:`slaveDelay`
is also set.

:option replIndexPrefetch:

:option supportCompatibilityFormPrivilegeDocuments:

:option boolean enableTestCommands:

.. versionadded: 2.4

This option **cannot** be specified using the :dbcommand:`setParameter`
command. This option can only be specified on the :program:`mongod`
command invocation.
This option enables the following internal commands:

- :dbcommand:`captrunc`
- :dbcommand:`configureFailPoint`
- :dbcommand:`emptycapped`
- :dbcommand:`godinsert`
- :dbcommand:`_hashBSONElement`
- :dbcommand:`journalLatencyTest`
- :dbcommand:`replSetTest`
- :dbcommand:`_skewClockCommand`
- :dbcommand:`sleep`
- :dbcommand:`_testDistLockWithSkew`
- :dbcommand:`_testDistLockWithSyncCluster`

.. slave-ok, admin-only
3 changes: 3 additions & 0 deletions source/reference/command/skewClockCommand.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ skewClockCommand (internal)
:dbcommand:`_skewClockCommand` is an internal command. Do not call
directly.

.. |dbcommand| replace:: :dbcommand:`_skewClockCommand`
.. include:: /includes/note-enabletestcommands.rst

.. admin-only
3 changes: 3 additions & 0 deletions source/reference/command/sleep.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ sleep (internal)
instance for the specified amount of time.

.. read-lock, write-lock, global-lock

.. |dbcommand| replace:: :dbcommand:`sleep`
.. include:: /includes/note-enabletestcommands.rst
3 changes: 3 additions & 0 deletions source/reference/command/testDistLockWithSkew.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ testDistLockWithSkew (internal)
directly.

.. admin-only

.. |dbcommand| replace:: :dbcommand:`_testDistLockWithSkew`
.. include:: /includes/note-enabletestcommands.rst
3 changes: 3 additions & 0 deletions source/reference/command/testDistLockWithSyncCluster.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ testDistLockWithSyncCluster (internal)
directly.

.. admin-only

.. |dbcommand| replace:: :dbcommand:`_testDistLockWithSyncCluster`
.. include:: /includes/note-enabletestcommands.rst
60 changes: 60 additions & 0 deletions source/reference/mongod.txt
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,66 @@ Options
for the :option:`--repair` operation. Defaults to a ``_tmp``
directory within the :setting:`dbpath`.

.. option:: --setParameter <options>

Specifies an option to configure on startup. Specify multiple options
with multiple :option:`--setParameter` options.
See :dbcommand:`setParameter` for a list of options which may be set
with :option:`--setParameter`.

.. option:: --setParameter enableTestCommands=1

.. versionadded:: 2.4

Use :option:`--setParameter enableTestCommands=1` to enable a series
of internal commands. This option can only be enabled on
invocation of :program:`mongod` and cannot be enabled with the
:dbcommand:`setParameter` command.

This option enables the following internal commands:

- :dbcommand:`captrunc`
- :dbcommand:`configureFailPoint`
- :dbcommand:`emptycapped`
- :dbcommand:`godinsert`
- :dbcommand:`_hashBSONElement`
- :dbcommand:`journalLatencyTest`
- :dbcommand:`replSetTest`
- :dbcommand:`_skewClockCommand`
- :dbcommand:`sleep`
- :dbcommand:`_testDistLockWithSkew`
- :dbcommand:`_testDistLockWithSyncCluster`

.. option:: --setParameter <options>

Specifies an option to configure on startup. Specify multiple options
with multiple :option:`--setParameter` options.
See :dbcommand:`setParameter` for a list of options which may be set
with :option:`--setParameter`.

.. option:: --setParameter enableTestCommands=1

.. versionadded:: 2.4

Use :option:`--setParameter enableTestCommands=1` to enable a series
of internal commands. This option can only be enabled on
invocation of :program:`mongod` and cannot be enabled with the
:dbcommand:`setParameter` command.

This option enables the following internal commands:

- :dbcommand:`captrunc`
- :dbcommand:`configureFailPoint`
- :dbcommand:`emptycapped`
- :dbcommand:`godinsert`
- :dbcommand:`_hashBSONElement`
- :dbcommand:`journalLatencyTest`
- :dbcommand:`replSetTest`
- :dbcommand:`_skewClockCommand`
- :dbcommand:`sleep`
- :dbcommand:`_testDistLockWithSkew`
- :dbcommand:`_testDistLockWithSyncCluster`

.. option:: --slowms <value>

Defines the value of "slow," for the :option:`--profile`
Expand Down