Skip to content

(DOCS-13395): slowOpSampleRate affects secondary logs #6113

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 1 commit into from
Nov 9, 2021
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
5 changes: 2 additions & 3 deletions source/core/replica-set-oplog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ there is any unintended replication delay.
See :ref:`Replication Lag <replica-set-replication-lag>` for more
information.

.. _slow-oplog-application:

Slow Oplog Application
----------------------

Expand All @@ -223,9 +225,6 @@ longer than the slow operation threshold to apply. These messages are

The slow oplog application logging on secondaries are:

- Not affected by the :setting:`~operationProfiling.slowOpSampleRate`;
i.e. all slow oplog entries are logged by the secondary.

- Not affected by the
:parameter:`logLevel`/:setting:`systemLog.verbosity` level (or the
:setting:`systemLog.component.replication.verbosity` level); i.e. for
Expand Down
37 changes: 27 additions & 10 deletions source/includes/extracts-4.2-changes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,33 @@ content: |
ref: 4.2-changes-slow-oplog-log-message-footnote
content: |

Starting in version 4.2 (also available starting in 4.0.6), secondary members of a replica set now
:ref:`log oplog entries <slow-oplog>` that take longer than the slow
operation threshold to apply. These slow oplog messages are logged
for the secondaries in the :option:`diagnostic log <mongod
--logpath>` under the :data:`REPL` component with the text ``applied
op: <oplog entry> took <num>ms``. These slow oplog entries depend
only on the slow operation threshold. They do not depend on the log
levels (either at the system or component level), or the profiling
level, or the slow operation sample rate. The profiler does not
capture slow oplog entries.
Starting in version 4.2 (also available starting in 4.0.6), secondary
members of a replica set now :ref:`log oplog entries
<slow-oplog-application>` that take longer than the slow operation
threshold to apply. These slow oplog messages:

- Are logged for the secondaries in the
:option:`diagnostic log <mongod --logpath>`.

- Are logged under the :data:`REPL` component with the text
``applied op: <oplog entry> took <num>ms``.

- Do not depend on the log levels (either at the system or component
level)

- Do not depend on the profiling level.

- May be affected by :setting:`~operationProfiling.slowOpSampleRate`,
depending on your MongoDB version:

- In MongoDB 4.2 and earlier, these slow oplog entries are not
affected by the :setting:`~operationProfiling.slowOpSampleRate`.
MongoDB logs all slow oplog entries regardless of the sample rate.

- In MongoDB 4.4 and later, these slow oplog entries are affected by
the :setting:`~operationProfiling.slowOpSampleRate`.

The profiler does not capture slow oplog entries.
---
ref: 4.2-changes-type-0
content: |
Expand Down
5 changes: 1 addition & 4 deletions source/includes/fact-log-slow-queries.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

When :parameter:`logLevel` is set to ``0``, MongoDB records *slow*
operations to the diagnostic log at a rate determined by
:setting:`~operationProfiling.slowOpSampleRate`. Starting in MongoDB
4.2, the secondaries of replica sets log :ref:`all oplog entry messages
that take longer than the slow operation threshold to apply
<slow-oplog>` regardless of the sample rate.
:setting:`~operationProfiling.slowOpSampleRate`.

At higher :parameter:`logLevel` settings, all operations appear in
the diagnostic log regardless of their latency with the following
Expand Down
9 changes: 2 additions & 7 deletions source/reference/configuration-options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4084,13 +4084,8 @@ LDAP Parameters
*Default*: 1.0

The fraction of *slow* operations that should be profiled or logged.
:setting:`operationProfiling.slowOpSampleRate` accepts values between 0 and 1, inclusive.

:setting:`operationProfiling.slowOpSampleRate` does not affect the :ref:`slow oplog entry logging
<slow-oplog>` by the secondary members of a replica set. Secondary
members log all oplog entries that take longer than the slow
operation threshold regardless of the :setting:`operationProfiling.slowOpSampleRate`.

:setting:`operationProfiling.slowOpSampleRate` accepts values between
0 and 1, inclusive.

.. versionchanged:: 4.0

Expand Down
2 changes: 1 addition & 1 deletion source/reference/method/db.setProfilingLevel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Parameters

.. list-table::
:stub-columns: 1
:widths: 15 85
:widths: 25 75

* - :ref:`slowms <set-profiling-level-options-slowms>`

Expand Down
4 changes: 2 additions & 2 deletions source/release-notes/4.2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1467,9 +1467,9 @@ Logging
temporary files due to memory restrictions. For more information on
aggregation memory restrictions, see :ref:`agg-memory-restrictions`.

- .. _slow-oplog:
.. _slow-oplog:

Starting in version 4.2 (also available starting in 4.0.6),
- Starting in version 4.2 (also available starting in 4.0.6),
secondary members of a replica set now log oplog entries that take
longer than the slow operation threshold to apply. These messages are
:option:`logged <mongod --logpath>` for the secondaries under the
Expand Down
13 changes: 13 additions & 0 deletions source/release-notes/4.4.txt
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,19 @@ restart.

:doc:`/core/replica-set-oplog`


``slowOpSampleRate`` Affects Secondary Logs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Starting in MongoDB 4.4, :ref:`slow oplog application
<slow-oplog-application>` logs on replica set secondaries are affected
by the :setting:`~operationProfiling.slowOpSampleRate`. In previous
versions, MongoDB logs all slow oplog entries regardless of the sample
rate.

:setting:`~operationProfiling.slowOpSampleRate` specifies the fraction
of slow operations that should be profiled or logged.

Indexes Build Simultaneously on Data-Bearing Replica Set Members
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down