Skip to content

Commit 5e3d720

Browse files
committed
DOCSP-6170 secondary reads no longer blocked by replication batches
1 parent 18d039a commit 5e3d720

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

source/core/replica-set-sync.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,20 @@ improve concurrency. MongoDB groups batches by namespace (:ref:`MMAPv1
116116
operations using a different thread. MongoDB always applies write
117117
operations to a given document in their original write order.
118118

119-
While applying a batch, MongoDB blocks all read operations. As a
120-
result, secondary read queries can never return data that reflect a
121-
state that never existed on the primary.
119+
.. versionchanged:: 4.0
120+
121+
Starting in MongoDB 4.0, read operations that
122+
:ref:`target secondaries <replica-set-read-preference>` and are
123+
configured with a :ref:`read concern<read-concern>` level of
124+
:readconcern:`"local"` or :readconcern:`"majority"` will now read from
125+
a :ref:`WiredTiger<storage-wiredtiger>` snapshot of the data if the read
126+
takes place on a secondary where replication batches are being applied.
127+
Reading from a snapshot guarantees a consistent view of the
128+
data, and allows the read to occur simultaneously with the ongoing
129+
replication without the need for a lock. As a result, secondary reads
130+
requiring these read concern levels no longer need to wait for
131+
replication batches to be applied, and can be handled as they are
132+
received.
122133

123134
Pre-Fetching Indexes to Improve Replication Throughput
124135
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)