From 9f470971dc6327301c96a70f646a22667f8bfb0a Mon Sep 17 00:00:00 2001 From: Jeff Allen Date: Thu, 28 Oct 2021 16:23:38 -0400 Subject: [PATCH] (DOCS-13395): slowOpSampleRate affects secondary logs --- source/core/replica-set-oplog.txt | 5 +-- source/includes/extracts-4.2-changes.yaml | 37 ++++++++++++++----- source/includes/fact-log-slow-queries.rst | 5 +-- source/reference/configuration-options.txt | 9 +---- .../reference/method/db.setProfilingLevel.txt | 2 +- source/release-notes/4.2.txt | 4 +- source/release-notes/4.4.txt | 13 +++++++ 7 files changed, 48 insertions(+), 27 deletions(-) diff --git a/source/core/replica-set-oplog.txt b/source/core/replica-set-oplog.txt index a86ba79ccd3..caaaf7ddaf2 100644 --- a/source/core/replica-set-oplog.txt +++ b/source/core/replica-set-oplog.txt @@ -207,6 +207,8 @@ there is any unintended replication delay. See :ref:`Replication Lag ` for more information. +.. _slow-oplog-application: + Slow Oplog Application ---------------------- @@ -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 diff --git a/source/includes/extracts-4.2-changes.yaml b/source/includes/extracts-4.2-changes.yaml index 4e47d283058..51b6cfe16b6 100644 --- a/source/includes/extracts-4.2-changes.yaml +++ b/source/includes/extracts-4.2-changes.yaml @@ -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 ` that take longer than the slow - operation threshold to apply. These slow oplog messages are logged - for the secondaries in the :option:`diagnostic log ` under the :data:`REPL` component with the text ``applied - op: took 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 + ` that take longer than the slow operation + threshold to apply. These slow oplog messages: + + - Are logged for the secondaries in the + :option:`diagnostic log `. + + - Are logged under the :data:`REPL` component with the text + ``applied op: took 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: | diff --git a/source/includes/fact-log-slow-queries.rst b/source/includes/fact-log-slow-queries.rst index 1514b50f1e7..748a1c0d217 100644 --- a/source/includes/fact-log-slow-queries.rst +++ b/source/includes/fact-log-slow-queries.rst @@ -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 -` 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 diff --git a/source/reference/configuration-options.txt b/source/reference/configuration-options.txt index 7ba28273d11..723329f4573 100644 --- a/source/reference/configuration-options.txt +++ b/source/reference/configuration-options.txt @@ -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 - ` 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 diff --git a/source/reference/method/db.setProfilingLevel.txt b/source/reference/method/db.setProfilingLevel.txt index b2f94870075..8ddaa32addd 100644 --- a/source/reference/method/db.setProfilingLevel.txt +++ b/source/reference/method/db.setProfilingLevel.txt @@ -116,7 +116,7 @@ Parameters .. list-table:: :stub-columns: 1 - :widths: 15 85 + :widths: 25 75 * - :ref:`slowms ` diff --git a/source/release-notes/4.2.txt b/source/release-notes/4.2.txt index c2041652a5a..ebe4f69414a 100644 --- a/source/release-notes/4.2.txt +++ b/source/release-notes/4.2.txt @@ -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 ` for the secondaries under the diff --git a/source/release-notes/4.4.txt b/source/release-notes/4.4.txt index 061291ed008..ab8df23174e 100644 --- a/source/release-notes/4.4.txt +++ b/source/release-notes/4.4.txt @@ -556,6 +556,19 @@ restart. :doc:`/core/replica-set-oplog` + +``slowOpSampleRate`` Affects Secondary Logs +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Starting in MongoDB 4.4, :ref:`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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~