Skip to content

Commit ed2c16b

Browse files
authored
DOCSP-19341 adds initialSyncMethod serer parameter (#167)
1 parent a591573 commit ed2c16b

File tree

3 files changed

+97
-15
lines changed

3 files changed

+97
-15
lines changed

source/core/replica-set-sync.txt

Lines changed: 56 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,37 +33,78 @@ source using the :parameter:`initialSyncSourceReadPreference` parameter.
3333
This parameter can only be specified when starting the
3434
:binary:`~bin.mongod`.
3535

36-
Process
37-
~~~~~~~
36+
Starting in MongoDB 5.2, initial syncs can be *logical* or *file copy
37+
based*.
3838

39-
When you perform an initial sync, MongoDB:
39+
.. _replica-set-initial-sync-logical:
40+
41+
Logical Initial Sync Process
42+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43+
44+
When you perform a
45+
:ref:`logical initial sync <replica-set-initial-sync-logical>`, MongoDB:
4046

4147
#. Clones all databases except the :ref:`local
4248
<replica-set-local-database>` database. To clone, the
4349
:binary:`~bin.mongod` scans every collection in each source database and
4450
inserts all data into its own copies of these collections.
4551

46-
.. versionchanged:: 3.4
47-
Initial sync builds all collection indexes as the documents are
48-
copied for each collection. In earlier versions of MongoDB, only
49-
the ``_id`` indexes are built during this stage.
50-
51-
.. versionchanged:: 3.4
52-
Initial sync pulls newly added oplog records during the data copy. Ensure
53-
that the target member has enough disk space in the ``local``
54-
database to temporarily store these oplog records for the
55-
duration of this data copy stage.
52+
#. Builds all collection indexes as the documents are copied for each
53+
collection.
54+
55+
#. Pulls newly added oplog records during the data copy. Ensure that the
56+
target member has enough disk space in the ``local`` database to
57+
temporarily store these oplog records for the duration of this data
58+
copy stage.
5659

5760
#. Applies all changes to the data set. Using the oplog from the
5861
source, the :binary:`~bin.mongod` updates its data set to reflect the
5962
current state of the replica set.
6063

61-
When the initial sync finishes, the member transitions from
62-
:replstate:`STARTUP2` to :replstate:`SECONDARY`.
64+
When the initial sync finishes, the member transitions from
65+
:replstate:`STARTUP2` to :replstate:`SECONDARY`.
6366

6467
To perform an initial sync, see
6568
:doc:`/tutorial/resync-replica-set-member`.
6669

70+
.. _replica-set-initial-sync-file-copy-based:
71+
72+
File Copy Based Initial Sync
73+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
74+
75+
:ref:`File copy based initial sync
76+
<replica-set-initial-sync-filed-copy-based>` runs the initial sync
77+
process by copying and moving files on the file system.
78+
79+
File copy based initial sync can be faster than
80+
:ref:`logical initial sync <replica-set-initial-sync-logical>`.
81+
82+
It is only available on Enterprise Server.
83+
84+
Limitations
85+
```````````
86+
87+
- File copy based initial sync replaces the ``local`` database on the
88+
node being *synced to* with the ``local`` database from the node
89+
being *synced from*.
90+
91+
- You can only run an initial sync from one given node at a time.
92+
93+
- You cannot run a backup on the node that is being *synced to* during
94+
the initial sync.
95+
96+
- You cannot run a backup on the node that is being *synced from* during
97+
the initial sync.
98+
99+
- You cannot use file copy based initial sync with encrypted storage
100+
engine to re-key the data.
101+
102+
.. warning::
103+
104+
You cannot write to the ``local`` database during a file copy based
105+
sync.
106+
107+
67108
.. _init-sync-retry:
68109

69110
Fault Tolerance

source/reference/parameters.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2389,6 +2389,32 @@ Replication and Consistency
23892389
configuration file setting or the
23902390
:option:`--setParameter <mongod --setParameter>` command line option.
23912391

2392+
.. parameter:: initialSyncMethod
2393+
2394+
.. versionadded:: 5.2
2395+
2396+
|mongod-only|
2397+
2398+
*Type*: String
2399+
2400+
*Default*: ``logical``
2401+
2402+
Method used for :ref:`initial sync <replica-set-initial-sync>`.
2403+
2404+
Set to ``logical`` to use :ref:`logical initial sync
2405+
<replica-set-initial-sync-logical>`. Set to ``fileCopyBased`` to
2406+
use :ref:`file copy based initial sync
2407+
<replica-set-initial-sync-file-copy-based>`.
2408+
2409+
You can only set this parameter on startup, using either the
2410+
:setting:`setParameter` configuration file setting or the
2411+
:option:`--setParameter <mongod --setParameter>` command line option.
2412+
2413+
.. note::
2414+
2415+
Available only in MongoDB Enterprise.
2416+
2417+
23922418
.. parameter:: maxNumSyncSourceChangesPerHour
23932419

23942420
.. versionadded:: 5.0

source/release-notes/5.2.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,21 @@ of the:
8787
To omit custom data from command output, specify the ``showCustomData:
8888
false`` option.
8989

90+
Replica Sets
91+
------------
92+
93+
``initialSyncMethod`` Parameter
94+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
95+
96+
Starting in MongoDB 5.2, the :parameter:`initialSyncMethod` determines
97+
whether :ref:`initial sync <replica-set-initial-sync>` is a
98+
:ref:`logical initial sync <replica-set-initial-sync-logical>` or a
99+
:ref:`file copy based initial sync
100+
<replica-set-initial-sync-file-copy-based>`.
101+
102+
:parameter:`initialSyncMethod` is only available in MongoDB Enterprise
103+
Server.
104+
90105
Report an Issue
91106
---------------
92107

0 commit comments

Comments
 (0)