summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/repl_server_parameters.idl
blob: f1b801ee1f406a9000f19095edbf21b1c8f20822 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
# Copyright (C) 2018-present MongoDB, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the Server Side Public License, version 1,
# as published by MongoDB, Inc.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# Server Side Public License for more details.
#
# You should have received a copy of the Server Side Public License
# along with this program. If not, see
# <http://www.mongodb.com/licensing/server-side-public-license>.
#
# As a special exception, the copyright holders give permission to link the
# code of portions of this program with the OpenSSL library under certain
# conditions as described in each individual source file and distribute
# linked combinations including the program with the OpenSSL library. You
# must comply with the Server Side Public License in all respects for
# all of the code used other than as permitted herein. If you modify file(s)
# with this exception, you may extend this exception to your version of the
# file(s), but you are not obligated to do so. If you do not wish to do so,
# delete this exception statement from your version. If you delete this
# exception statement from all source files in the program, then also delete
# it in the license file.
#

# server setParameters for replication

global:
    cpp_namespace: "mongo::repl"
    cpp_includes:
      - "mongo/client/read_preference.h"

imports:
    - "mongo/idl/basic_types.idl"

server_parameters:
    # From data_replicator_external_state_impl.cpp
    initialSyncOplogBuffer:
        description: >-
            Set this to specify whether to use a collection to buffer the oplog on the
            destination server during initial sync to prevent rolling over the oplog.
        set_at: startup
        cpp_vartype: std::string
        cpp_varname: initialSyncOplogBuffer
        default: "collection"

    initialSyncOplogBufferPeekCacheSize:
        description: Set this to specify size of read ahead buffer in the OplogBufferCollection.
        set_at: startup
        cpp_vartype: int
        cpp_varname: initialSyncOplogBufferPeekCacheSize
        default: 10000

    # From initial_syncer.cpp
    numInitialSyncConnectAttempts:
        description: The number of attempts to connect to a sync source
        set_at: [ startup, runtime ]
        cpp_vartype: AtomicWord<int>
        cpp_varname: numInitialSyncConnectAttempts
        default: 10

    numInitialSyncOplogFindAttempts:
        description: The number of attempts to call find on the remote oplog
        set_at: [ startup, runtime ]
        cpp_vartype: AtomicWord<int>
        cpp_varname: numInitialSyncOplogFindAttempts
        default: 3

    initialSyncOplogFetcherBatchSize:
        description: The batchSize to use for the find/getMore queries called by the OplogFetcher
        set_at: startup
        cpp_vartype: int
        cpp_varname: initialSyncOplogFetcherBatchSize
        # 16MB max batch size / 12 byte min doc size * 10 (for good measure) =
        #     defaultBatchSize to use.
        default:
            expr: (16 * 1024 * 1024) / 12 * 10

    # From oplog_fetcher.cpp
    oplogInitialFindMaxSeconds:
        description: >-
            Number of seconds for the `maxTimeMS` on the initial `find` command.
            For the initial 'find' request, we provide a generous timeout, to account for
            the potentially slow process of a sync source finding the lastApplied optime
            provided in a node's query in its oplog.
        set_at: [ startup, runtime ]
        cpp_vartype: AtomicWord<int>
        cpp_varname: oplogInitialFindMaxSeconds
        default: 60

    oplogRetriedFindMaxSeconds:
        description: Number of seconds for the `maxTimeMS` on any retried `find` commands
        set_at: [ startup, runtime ]
        cpp_vartype: AtomicWord<int>
        cpp_varname: oplogRetriedFindMaxSeconds
        default: 2

    oplogFetcherUsesExhaust:
        description: >-
            Whether to use the "exhaust cursor" feature when fetching oplog entries from the sync
            source.
        set_at: startup
        cpp_vartype: bool
        cpp_varname: oplogFetcherUsesExhaust
        default: true

    # From bgsync.cpp
    bgSyncOplogFetcherBatchSize:
        description: The batchSize to use for the find/getMore queries called by the OplogFetcher
        set_at: startup
        cpp_vartype: int
        cpp_varname: bgSyncOplogFetcherBatchSize
        # 16MB max batch size / 12 byte min doc size * 10 (for good measure) =
        #     defaultBatchSize to use.
        default:
            expr: (16 * 1024 * 1024) / 12 * 10

    rollbackRemoteOplogQueryBatchSize:
        description: >-
            The batchSize to use for the find/getMore queries called by the rollback
            common point resolver. A batchSize of 0 means that the 'find' and 'getMore'
            commands will be given no batchSize. We set the default to 2000 to prevent
            the sync source from having to read too much data at once, and reduce the
            chance of a socket timeout.
        set_at: [ startup, runtime ]
        cpp_vartype: AtomicWord<int>
        cpp_varname: rollbackRemoteOplogQueryBatchSize
        # We choose 2000 for (10 minute timeout) * (60 sec / min) * (50 MB / second) /
        #     (16 MB / document).
        default: 2000

    forceRollbackViaRefetch:
        description: >-
            If 'forceRollbackViaRefetch' is true, always perform rollbacks via the
            refetch algorithm, even if the storage engine supports rollback via recover
            to timestamp.
        set_at: [ startup, runtime ]
        cpp_vartype: AtomicWord<bool>
        cpp_varname: forceRollbackViaRefetch
        default: false

    # From noop_writer.cpp
    writePeriodicNoops:
        description: Sets whether to write periodic noops or not
        set_at: [ startup, runtime ]
        cpp_vartype: AtomicWord<bool>
        cpp_varname: writePeriodicNoops
        default: true

    collectionClonerUsesExhaust:
        description: Whether to use the "exhaust cursor" feature when retrieving collection data.
        set_at: startup
        cpp_vartype: bool
        cpp_varname: collectionClonerUsesExhaust
        default: true

    # From collection_bulk_loader_impl.cpp
    collectionBulkLoaderBatchSizeInBytes:
        description: >-
            Limit for the number of bytes of data inserted per storage transaction
            (WriteUnitOfWork) by collectionBulkLoader during initial sync collection cloning
        set_at: startup
        cpp_vartype: int
        cpp_varname: collectionBulkLoaderBatchSizeInBytes
        default:
            expr: 256 * 1024

    # From database_cloner.cpp
    collectionClonerBatchSize:
        description: >-
            The batch size (number of documents) to use for the queries in the
            CollectionCloner. Default of '0' means the limit is the number of documents
            that will fit in a single BSON object.
        set_at: startup
        cpp_vartype: int
        cpp_varname: collectionClonerBatchSize
        default: 0
        validator:
            gte: 0

    # From replication_coordinator_external_state_impl.cpp
    oplogFetcherSteadyStateMaxFetcherRestarts:
        description: >-
            Set this to specify the maximum number of times the oplog fetcher will
            consecutively restart the oplog tailing query on non-cancellation errors
            during steady state replication.
        set_at: [ startup, runtime ]
        cpp_vartype: AtomicWord<int>
        cpp_varname: oplogFetcherSteadyStateMaxFetcherRestarts
        default: 1
        validator:
            gte: 0

    oplogFetcherInitialSyncMaxFetcherRestarts:
        description: >-
            Set this to specify the maximum number of times the oplog fetcher will
            consecutively restart the oplog tailing query on non-cancellation errors
            during initial sync. By default we provide a generous amount of restarts
            to avoid potentially restarting an entire initial sync from scratch.
        set_at: [ startup, runtime ]
        cpp_vartype: AtomicWord<int>
        cpp_varname: oplogFetcherInitialSyncMaxFetcherRestarts
        default: 10
        validator:
            gte: 0

    # From oplog_applier.cpp
    replWriterThreadCount:
        description: The number of threads in the thread pool used to apply the oplog
        set_at: startup
        cpp_vartype: int
        cpp_varname: replWriterThreadCount
        default: 16
        validator:
            gte: 1
            lte: 256

    replBatchLimitOperations:
        description: The maximum number of operations to apply in a single batch
        set_at: [ startup, runtime ]
        cpp_vartype: AtomicWord<int>
        cpp_varname: replBatchLimitOperations
        default:
            expr: 5 * 1000
        validator:
            gte: 1
            lte:
                expr: 1000 * 1000

    replBatchLimitBytes:
        description: The maximum oplog application batch size in bytes
        set_at: [ startup, runtime ]
        cpp_vartype: AtomicWord<int>
        cpp_varname: replBatchLimitBytes
        default:
            expr: 100 * 1024 * 1024
        validator:
            gte:
                expr: 16 * 1024 * 1024
            lte:
                expr: 100 * 1024 * 1024

    # New parameters since this file was created, not taken from elsewhere.
    initialSyncTransientErrorRetryPeriodSeconds:
        description: >-
            The amount of time to continue retrying transient errors during initial sync before
            declaring the attempt failed.
        set_at: [ startup, runtime ]
        cpp_vartype: AtomicWord<int>
        cpp_varname: initialSyncTransientErrorRetryPeriodSeconds
        default:
            expr: 24 * 60 * 60
        validator:
            gte: 0

    oplogNetworkTimeoutBufferSeconds:
        description: >-
            Number of seconds to add to the `find` and `getMore` timeouts for oplog fetching to
            calculate the network timeout for the requests.
        set_at: [ startup ]
        cpp_vartype: AtomicWord<int>
        cpp_varname: oplogNetworkTimeoutBufferSeconds
        default: 5
        validator:
            gte: 0

    # TODO: Remove in SERVER-46541.
    enableAutomaticReconfig:
        description: >-
            Enables the 'newlyAdded' field in member configs to be set, as part of automatic
            reconfig.
        set_at: startup
        test_only: true
        cpp_vartype: bool
        cpp_varname: enableAutomaticReconfig
        default: true

    oplogApplicationEnforcesSteadyStateConstraints:
        description: >-
            Whether or not secondary oplog application enforces (by fassert) consistency
            constraints that apply if an oplog entry is to be applied exactly once and in order.
        set_at: startup
        cpp_vartype: bool
        cpp_varname: oplogApplicationEnforcesSteadyStateConstraints
        default: false

    initialSyncSourceReadPreference:
        description: >-
            Set this to specify how the sync source for initial sync is determined.
            Valid options are: nearest, primary, primaryPreferred, secondary,
            and secondaryPreferred.
        set_at: startup
        cpp_vartype: std::string
        cpp_varname: initialSyncSourceReadPreference
        # When the default is used, if chaining is disabled in the config then readPreference is
        # 'primary'.  Otherwise, if the node is a voting node, readPreference is 'primaryPreferred'
        # and if it is not, readPreference is 'nearest'.
        default: ""
        validator: { callback: 'validateReadPreferenceMode' }

    changeSyncSourceThresholdMillis:
        description: >-
            Threshold between ping times that are considered as coming from the same data center
            and ping times considered as coming from a different data center. Used to determine
            if the node should attempt to change sync sources because another node is significantly
            closer than its current sync source.
        set_at: [ startup, runtime ]
        cpp_vartype: AtomicWord<long long>
        cpp_varname: changeSyncSourceThresholdMillis
        default: 5
        validator:
            gte: 0

    maxNumSyncSourceChangesPerHour:
        description: >-
            The number of sync source changes that can happen per hour before the node temporarily
            turns off reevaluating its sync source. This will only affect sync source changes while
            a node has a valid sync source.
        set_at: [ startup, runtime ]
        cpp_vartype: AtomicWord<int>
        cpp_varname: maxNumSyncSourceChangesPerHour
        default: 3
        validator:
            gt: 0