Skip to content

Commit 459754f

Browse files
(DOCS-13395): slowOpSampleRate affects secondary logs
1 parent cb087c4 commit 459754f

File tree

7 files changed

+48
-27
lines changed

7 files changed

+48
-27
lines changed

source/core/replica-set-oplog.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ there is any unintended replication delay.
207207
See :ref:`Replication Lag <replica-set-replication-lag>` for more
208208
information.
209209

210+
.. _slow-oplog-application:
211+
210212
Slow Oplog Application
211213
----------------------
212214

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

224226
The slow oplog application logging on secondaries are:
225227

226-
- Not affected by the :setting:`~operationProfiling.slowOpSampleRate`;
227-
i.e. all slow oplog entries are logged by the secondary.
228-
229228
- Not affected by the
230229
:parameter:`logLevel`/:setting:`systemLog.verbosity` level (or the
231230
:setting:`systemLog.component.replication.verbosity` level); i.e. for

source/includes/extracts-4.2-changes.yaml

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,33 @@ content: |
9797
ref: 4.2-changes-slow-oplog-log-message-footnote
9898
content: |
9999
100-
Starting in version 4.2 (also available starting in 4.0.6), secondary members of a replica set now
101-
:ref:`log oplog entries <slow-oplog>` that take longer than the slow
102-
operation threshold to apply. These slow oplog messages are logged
103-
for the secondaries in the :option:`diagnostic log <mongod
104-
--logpath>` under the :data:`REPL` component with the text ``applied
105-
op: <oplog entry> took <num>ms``. These slow oplog entries depend
106-
only on the slow operation threshold. They do not depend on the log
107-
levels (either at the system or component level), or the profiling
108-
level, or the slow operation sample rate. The profiler does not
109-
capture slow oplog entries.
100+
Starting in version 4.2 (also available starting in 4.0.6), secondary
101+
members of a replica set now :ref:`log oplog entries
102+
<slow-oplog-application>` that take longer than the slow operation
103+
threshold to apply. These slow oplog messages:
104+
105+
- Are logged for the secondaries in the
106+
:option:`diagnostic log <mongod --logpath>`.
107+
108+
- Are logged under the :data:`REPL` component with the text
109+
``applied op: <oplog entry> took <num>ms``.
110+
111+
- Do not depend on the log levels (either at the system or component
112+
level)
113+
114+
- Do not depend on the profiling level.
115+
116+
- May be affected by :setting:`~operationProfiling.slowOpSampleRate`,
117+
depending on your MongoDB version:
118+
119+
- In MongoDB 4.2 and earlier, these slow oplog entries are not
120+
affected by the :setting:`~operationProfiling.slowOpSampleRate`.
121+
MongoDB logs all slow oplog entries regardless of the sample rate.
122+
123+
- In MongoDB 4.4 and later, these slow oplog entries are affected by
124+
the :setting:`~operationProfiling.slowOpSampleRate`.
125+
126+
The profiler does not capture slow oplog entries.
110127
---
111128
ref: 4.2-changes-type-0
112129
content: |

source/includes/fact-log-slow-queries.rst

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
33
When :parameter:`logLevel` is set to ``0``, MongoDB records *slow*
44
operations to the diagnostic log at a rate determined by
5-
:setting:`~operationProfiling.slowOpSampleRate`. Starting in MongoDB
6-
4.2, the secondaries of replica sets log :ref:`all oplog entry messages
7-
that take longer than the slow operation threshold to apply
8-
<slow-oplog>` regardless of the sample rate.
5+
:setting:`~operationProfiling.slowOpSampleRate`.
96

107
At higher :parameter:`logLevel` settings, all operations appear in
118
the diagnostic log regardless of their latency with the following

source/reference/configuration-options.txt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4084,13 +4084,8 @@ LDAP Parameters
40844084
*Default*: 1.0
40854085

40864086
The fraction of *slow* operations that should be profiled or logged.
4087-
:setting:`operationProfiling.slowOpSampleRate` accepts values between 0 and 1, inclusive.
4088-
4089-
:setting:`operationProfiling.slowOpSampleRate` does not affect the :ref:`slow oplog entry logging
4090-
<slow-oplog>` by the secondary members of a replica set. Secondary
4091-
members log all oplog entries that take longer than the slow
4092-
operation threshold regardless of the :setting:`operationProfiling.slowOpSampleRate`.
4093-
4087+
:setting:`operationProfiling.slowOpSampleRate` accepts values between
4088+
0 and 1, inclusive.
40944089

40954090
.. versionchanged:: 4.0
40964091

source/reference/method/db.setProfilingLevel.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Parameters
116116

117117
.. list-table::
118118
:stub-columns: 1
119-
:widths: 15 85
119+
:widths: 25 75
120120

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

source/release-notes/4.2.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,9 +1467,9 @@ Logging
14671467
temporary files due to memory restrictions. For more information on
14681468
aggregation memory restrictions, see :ref:`agg-memory-restrictions`.
14691469

1470-
- .. _slow-oplog:
1470+
.. _slow-oplog:
14711471

1472-
Starting in version 4.2 (also available starting in 4.0.6),
1472+
- Starting in version 4.2 (also available starting in 4.0.6),
14731473
secondary members of a replica set now log oplog entries that take
14741474
longer than the slow operation threshold to apply. These messages are
14751475
:option:`logged <mongod --logpath>` for the secondaries under the

source/release-notes/4.4.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,19 @@ restart.
556556

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

559+
560+
``slowOpSampleRate`` Affects Secondary Logs
561+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
562+
563+
Starting in MongoDB 4.4, :ref:`slow oplog application
564+
<slow-oplog-application>` logs on replica set secondaries are affected
565+
by the :setting:`~operationProfiling.slowOpSampleRate`. In previous
566+
versions, MongoDB logs all slow oplog entries regardless of the sample
567+
rate.
568+
569+
:setting:`~operationProfiling.slowOpSampleRate` specifies the fraction
570+
of slow operations that should be profiled or logged.
571+
559572
Indexes Build Simultaneously on Data-Bearing Replica Set Members
560573
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
561574

0 commit comments

Comments
 (0)