summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/repl_set_config.idl
blob: 47b94a347a03d82b128d35ccd66390ef7b56064b (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
# Copyright (C) 2019-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.
#

global:
    cpp_namespace: "mongo::repl"
    cpp_includes:
        - "mongo/db/repl/member_config.h"
        - "mongo/db/repl/repl_set_config_validators.h"
        - "mongo/db/repl/repl_set_tag.h"
        - "mongo/db/repl/repl_set_write_concern_mode_definitions.h"
        - "mongo/util/string_map.h"

imports:
    - "mongo/db/basic_types.idl"
    - "mongo/util/net/hostandport.idl"
    - "mongo/db/repl/replication_types.idl"
    - "mongo/db/repl/member_config.idl"
    - "mongo/db/write_concern_options.idl"

types:
    smallExactInt64:
        bson_serialization_type: any
        description: "Accepts any numerical type within int64 range.  Serializes as NumberInt if it
                      fits in an int32, NumberLong otherwise.  Rejects decimals and doubles that
                      are not integer values."
        cpp_type: std::int64_t
        serializer: ::smallExactInt64Append
        deserializer: ::parseSmallExactInt64

    termType:
        bson_serialization_type: any
        description: "Same as smallExactInt64, only is only serialized if not -1."
        cpp_type: std::int64_t
        serializer: ::serializeTermField
        deserializer: ::parseSmallExactInt64

    optionalBoolSerializeIfTrue:
        bson_serialization_type: any
        description: "Same as optionalBool, except only written if true."
        cpp_type: "mongo::OptionalBool"
        default: "mongo::OptionalBool()"
        deserializer: "mongo::OptionalBool::parseFromBSON"
        serializer: "::serializeOptionalBoolIfTrue"

    replSetWriteConcernModeMap:
        bson_serialization_type: any
        description: "A BSON object mapping write concern mode names to tag sets"
        cpp_type: ReplSetWriteConcernModeDefinitions
        serializer: ReplSetWriteConcernModeDefinitions::serializeToBSON
        deserializer: ReplSetWriteConcernModeDefinitions::parseFromBSON

structs:
    ReplSetConfigSettings:
        description: "The configuration options that apply to the whole replica set"
        strict: false
        fields:
            chainingAllowed:
                type: safeBool
                default: true
                description: "When true, the replica set allows secondary members to replicate
                              from other secondary members. When false, secondaries can replicate
                              only from the primary."
            heartbeatIntervalMillis:
                type: smallExactInt64
                default: 2000
                description: "The frequency in milliseconds of the heartbeats"
                validator: { gt: 0 }
            heartbeatTimeoutSecs:
                type: smallExactInt64
                default: 10
                description: "Number of seconds that the replica set members wait for a successful
                              heartbeat from each other"
                validator: { gt: 0 }
            electionTimeoutMillis:
                type: smallExactInt64
                default: 10000
                description: "The time limit in milliseconds for detecting when a replica set’s
                              primary is unreachable"
                validator: { gt: 0 }
            catchUpTimeoutMillis:
                type: smallExactInt64
                default: -1
                description: "Time limit in milliseconds for a newly elected primary to sync
                              (catch up) with the other replica set members that may have more
                              recent writes. If timeout is -1, infinite catchup time.  If timeout
                              is 0, newly elected primaries will not attempt to catch up"
                validator: { gte: -1 }
            catchUpTakeoverDelayMillis:
                type: smallExactInt64
                default: 30000
                description: "Time in milliseconds a node waits to initiate a catchup takeover
                              after determining it is ahead of the current primary. -1 disables
                              catchup takeover"
                validator: { gte: -1 }
            getLastErrorModes:
                type: replSetWriteConcernModeMap
                default: ReplSetWriteConcernModeDefinitions()
            getLastErrorDefaults:
                cpp_name: defaultWriteConcern
                type: WriteConcern
                default: WriteConcernOptions()
                validator: { callback: "validateDefaultWriteConcernHasMember"}
            replicaSetId:
                type: objectid
                optional: true
                validator: { callback: "validateReplicaSetIdNotNull"}

    ReplSetConfigBase:
        description: "The complete configuration for the replica set"
        fields:
            _id:
                cpp_name: replSetName
                type: string
                description: "The name of the replica set. Once set, you cannot change the name of
                              a replica set"
                validator: { callback: "validateReplSetNameNonEmpty"}
            version:
                cpp_name: configVersion
                type: smallExactInt64
                description: "An incrementing number used to distinguish revisions of the replica
                              set configuration object from previous iterations of the
                              configuration"
                validator: { gt: 0, lt: 2147483648 }
            term:
                cpp_name: configTerm
                type: termType
                description: "The configuration term is the term of the primary that originally
                              created this configuration. Configurations in a replica set are
                              totally ordered by their term and configuration version."
                default: -1
                validator: { gte: -1, lt: 2147483648 }
            members:
                type: array<memberConfig>
                description: "An array of member configuration documents, one for each member of
                              the replica set"
            configsvr:
                cpp_name: configServer
                type: optionalBoolSerializeIfTrue
                description: "Indicates whether the replica set is used for a sharded cluster’s
                              config servers. Set to true if the replica set is for a sharded
                              cluster’s config servers"
            protocolVersion:
                description: "Election protocol version.  Always 1, as PV0 is no longer supported"
                type: safeInt64
                default: 1
                validator: { gte: 1, lte: 1 }
            writeConcernMajorityJournalDefault:
                cpp_name: writeConcernMajorityShouldJournal
                description: >-
                    Determines the behavior of { w: "majority" } write concern if the write concern
                    does not explicitly specify the journal option j
                type: safeBool
                default: true
            settings:
                description: "A document that contains configuration options that apply to the whole
                              replica set."
                type: ReplSetConfigSettings
                optional: true
            repaired:
                description: "This field indicates the replicated data has been repaired, and
                              prevents use of the configuration until it is removed."
                type: optionalBool
            recipientConfig:
                description: "An optional field representing a config for a recipient during a shard
                              split operation. Due to compiler support issues, the type is set to
                              any."
                type: any
                ignore: true