Skip to content

DOCSP-6170 secondary reads no longer blocked by replication batches #4035

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
Apr 1, 2020
Merged
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
17 changes: 14 additions & 3 deletions source/core/replica-set-sync.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,20 @@ improve concurrency. MongoDB groups batches by namespace (:ref:`MMAPv1
operations using a different thread. MongoDB always applies write
operations to a given document in their original write order.

While applying a batch, MongoDB blocks all read operations. As a
result, secondary read queries can never return data that reflect a
state that never existed on the primary.
.. versionchanged:: 4.0

Starting in MongoDB 4.0, read operations that
:ref:`target secondaries <replica-set-read-preference>` and are
configured with a :ref:`read concern<read-concern>` level of
:readconcern:`"local"` or :readconcern:`"majority"` will now read from
a :ref:`WiredTiger<storage-wiredtiger>` snapshot of the data if the read
takes place on a secondary where replication batches are being applied.
Reading from a snapshot guarantees a consistent view of the
data, and allows the read to occur simultaneously with the ongoing
replication without the need for a lock. As a result, secondary reads
requiring these read concern levels no longer need to wait for
replication batches to be applied, and can be handled as they are
received.

Pre-Fetching Indexes to Improve Replication Throughput
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down