Skip to content

Commit 4667b33

Browse files
author
Dave Cuthbert
authored
DOCSP-28691 when to write to destination cluster (#118)
* DOCSP-28691 write blocking on dest cluster * DOCSP-28691 write blocking on dest cluster * DOCSP-28691 write blocking on dest cluster * Staging fixes * Staging fixes * Staging fixes * fake commit * Force build * Write blocking * Write blocking * Review feedback * Staging fixes * Heading * review feedback * Review feedback * Review feedback * Review feedback * Review feedback
1 parent 37773dd commit 4667b33

File tree

7 files changed

+77
-21
lines changed

7 files changed

+77
-21
lines changed

source/includes/api/tables/progress-response.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@
2020

2121
* - ``canWrite``
2222
- boolean
23-
- If ``true``, indicates that it is possible to write to the
24-
destination cluster. Index validation continues until the
25-
:ref:`commit <c2c-api-commit>` is complete.
23+
- If ``true``, indicates that writes are permitted on the
24+
destination cluster. Do not write to the destination cluster
25+
while ``canWrite`` is ``false``.
26+
27+
Index validation continues until the :ref:`commit
28+
<c2c-api-commit>` is complete.
2629

2730
* - ``info``
2831
- string
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
To see what state ``mongosync`` is in, call the :ref:`/progress
2+
<c2c-api-progress>` API endpoint. The ``/progress`` output includes a
3+
boolean value, ``canWrite``.
4+
5+
- When ``canWrite`` is ``true``, it is safe to write to the destination
6+
cluster.
7+
- When ``canWrite`` is ``false``, do not write to the destination
8+
cluster.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
When write-blocking is enabled, ``mongosync`` blocks writes:
2+
3+
- On the destination cluster during sync
4+
- On the source cluster while committing
5+
6+
To enable write-blocking, use the :ref:`start API <c2c-api-start>`
7+
to set ``enableUserWriteBlocking`` to ``true``. You cannot enable
8+
write-blocking after the sync starts.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
You can safely write to the source cluster while ``mongosync`` is
2+
syncing. Do not write to the destination cluster unless ``canWrite`` is
3+
``true``.

source/reference/api/reverse.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,13 @@ Requirements
3535

3636
To use the ``reverse`` endpoint:
3737

38-
- You must have started your original sync operation with the
39-
``reversible`` and ``enableUserWriteBlocking`` options set to
40-
``true``.
38+
- ``mongosync`` must be configured when the initial sync begins. The
39+
call to the :ref:`/start <c2c-api-start>` API endpoint must set:
40+
41+
- ``reversible`` to ``true``
42+
- ``enableUserWriteBlocking`` to ``true``
43+
44+
You cannot update these options after the sync starts.
4145
- ``mongosync`` must be in the ``COMMITTED`` state.
4246
- Source and destination clusters must be MongoDB 6.0 or later.
4347
- :ref:`Unique indexes <index-type-unique>` on the original source

source/reference/mongosync-states.txt

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ operations in that state.
4242
- Description
4343
- Possible API Operations
4444

45-
* - ``IDLE``
45+
* - .. _c2c-state-idle:
46+
47+
``IDLE``
4648
- ``mongosync`` is initialized and ready for a sync job to
4749
begin.
4850
- - ``POST`` :ref:`/start <c2c-api-start>`
@@ -62,7 +64,9 @@ operations in that state.
6264
- - ``POST`` :ref:`/resume <c2c-api-resume>`
6365
- ``GET`` :ref:`/progress <c2c-api-progress>`
6466

65-
* - ``COMMITTING``
67+
* - .. _c2c-state-committing:
68+
69+
``COMMITTING``
6670
- The cutover for the sync process has started. The time it takes
6771
to transition to the ``COMMITTED`` phase depends on
6872
``lagTimeSeconds``. To monitor ``lagTimeSeconds`` or to see if
@@ -73,3 +77,26 @@ operations in that state.
7377
* - ``COMMITTED``
7478
- The cutover for the sync process is complete.
7579
- - ``GET`` :ref:`/progress <c2c-api-progress>`
80+
81+
Read Operations
82+
---------------
83+
84+
Read operations on the source cluster are always permitted.
85+
86+
When the ``/progress`` endpoint reports ``canWrite`` is ``true``, the
87+
data on the source and destination clusters is consistent.
88+
89+
Write Operations
90+
----------------
91+
92+
.. include:: /includes/fact-write-blocking-check.rst
93+
94+
.. include:: /includes/fact-write-blocking-when.rst
95+
96+
Write-blocking
97+
~~~~~~~~~~~~~~
98+
99+
.. include:: /includes/fact-write-blocking-enable.rst
100+
101+
.. include:: /includes/fact-write-blocking-requirement.rst
102+

source/reference/mongosync.txt

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -200,27 +200,30 @@ show an empty ``system.views`` collection in that database. The empty
200200
``system.views`` collection will not change the accuracy of user
201201
data on the destination.
202202

203+
.. c2c-write-blocking:
204+
203205
Write Blocking
204206
~~~~~~~~~~~~~~
205207

206-
By default, write-blocking is not enabled during synchronization. When
207-
write-blocking is enabled, ``mongosync`` blocks writes:
208-
209-
- On the destination cluster during replication
210-
- On the source cluster while committing
208+
.. include:: /includes/fact-write-blocking-enable.rst
211209

212-
To enable write-blocking, use the :ref:`start API <c2c-api-start>`
213-
to set ``enableUserWriteBlocking`` to ``true``.
210+
Write-blocking is not enabled by default. You must enable write-blocking
211+
when you start ``mongosync`` if you want to use :ref:`reverse
212+
synchronization <c2c-api-reverse>` later.
214213

215-
:ref:`Reverse synchronization <c2c-api-reverse>` requires
216-
write-blocking. To enable reverse synchronization between the source
217-
and destination clusters, use the ``start API`` to initiate replication
218-
with ``reversible`` and ``enableUserWriteBlocking`` set to ``true``.
219-
The options must be set when replication begins, they cannot be updated
220-
later.
214+
User Permissions
215+
````````````````
221216

222217
.. include:: /includes/fact-write-blocking-requirement.rst
223218

219+
Permissible Writes
220+
``````````````````
221+
222+
.. include:: /includes/fact-write-blocking-check.rst
223+
224+
.. include:: /includes/fact-write-blocking-when.rst
225+
226+
224227
.. _c2c-capped-collections:
225228

226229
Capped Collections

0 commit comments

Comments
 (0)