summaryrefslogtreecommitdiff
path: root/src/mongo/db/metadata_consistency_types.idl
blob: a7eb00e28bad3609f076a87da2d7496dc5605895 (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
328
329
330
331
# Copyright (C) 2023-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"

imports:
    - "mongo/db/basic_types.idl"
    - "mongo/s/sharding_types.idl"

enums:
    MetadataInconsistencyType:
        description: "Type of metadata inconsistency."
        type: string
        values:
            kCollectionUUIDMismatch: "CollectionUUIDMismatch"
            kCorruptedChunkShardKey: "CorruptedChunkShardKey"
            kCorruptedZoneShardKey: "CorruptedZoneShardKey"
            kHiddenShardedCollection: "HiddenShardedCollection"
            kInconsistentIndex: "InconsistentIndex"
            kMisplacedCollection: "MisplacedCollection"
            kMissingRoutingTable: "MissingRoutingTable"
            kMissingShardKeyIndex: "MissingShardKeyIndex"
            kRoutingTableMissingMaxKey: "RoutingTableMissingMaxKey"
            kRoutingTableMissingMinKey: "RoutingTableMissingMinKey"
            kRoutingTableRangeGap: "RoutingTableRangeGap"
            kRoutingTableRangeOverlap: "RoutingTableRangeOverlap"
            kShardThinksCollectionIsUnsharded: "ShardThinksCollectionIsUnsharded"
            kZonesRangeOverlap: "ZonesRangeOverlap"

    MetadataInconsistencyDescription:
        description: "Description of each metadata inconsistency."
        type: string
        values:
            kCollectionUUIDMismatch: "Found collection on non primary shard with mismatching UUID"
            kCorruptedChunkShardKey: "Found chunk with a shard key pattern violation"
            kCorruptedZoneShardKey: "Found zone with a shard key pattern violation"
            kHiddenShardedCollection: "Found sharded collection but relative database does not exist"
            kInconsistentIndex: "Found an index of a sharded collection that is inconsistent between different shards"
            kMisplacedCollection: "Unsharded collection found on shard different from database primary shard"
            kMissingRoutingTable: "Found sharded collection without any chunk"
            kMissingShardKeyIndex: "Found sharded collection without a shard key index"
            kRoutingTableMissingMaxKey: "Routing table has a gap because last chunk boundary does not reach MaxKey"
            kRoutingTableMissingMinKey: "Routing table has a gap because first chunk does not start from MinKey"
            kRoutingTableRangeGap: "Found a gap between two consecutive chunks"
            kRoutingTableRangeOverlap: "Found two overlapping consecutive chunks"
            kShardThinksCollectionIsUnsharded: "Shard thinks collection is unsharded while instead is currently sharded"
            kZonesRangeOverlap: "Found two overlapping zones"

    MetadataConsistencyCommandLevel:
        description: "Level mode of the metadata consistency command."
        type: string
        values:
            kClusterLevel: "ClusterLevel"
            kDatabaseLevel: "DatabaseLevel"
            kCollectionLevel: "CollectionLevel"

structs:
    MisplacedCollectionDetails:
        description: "Details about a misplaced collection inconsistency."
        strict: false
        fields:
            namespace:
                cpp_name: nss
                type: namespacestring
                description: "The namespace of the collection that is misplaced."
            shard:
                type: shard_id
                description: "The shard where the collection is placed."
            localUUID:
                type: uuid
                description: "The UUID of the collection that is misplaced."

    CollectionUUIDMismatchDetails:
        description: "Details about a UUID mismatch inconsistency."
        strict: false
        fields:
            namespace:
                cpp_name: nss
                type: namespacestring
                description: "The namespace of the collection that has a UUID mismatch."
            shard:
                type: shard_id
                description: "The shard where the UUID mismatch inconsistency has been found."
            localUUID:
                type: uuid
                description: "The UUID of the collection found on the shard."
            uuid:
                type: uuid
                description: "The UUID of the collection found on the config server."

    MissingShardKeyIndexDetails:
        description: "Details about a missing shard key index inconsistency."
        strict: false
        fields:
            namespace:
                cpp_name: nss
                type: namespacestring
                description: "The namespace of the collection that is missing a shard key index."
            shard:
                type: shard_id
                description: "The shard where the missing shard key index inconsistency has been found."
            shardKey:
                type: object
                description: "The shard key of the collection."

    RoutingTableRangeOverlapDetails:
        description: "Details about a routing table range overlap inconsistency."
        strict: false
        fields:
            namespace:
                cpp_name: nss
                type: namespacestring
                description: "The namespace of the collection."
            collectionUUID:
                type: uuid
                description: "The UUID of the collection."
            chunkA:
                type: object
                description: "The first chunk that overlaps with the second chunk."
            chunkB:
                type: object
                description: "The second chunk that overlaps with the first chunk."

    RoutingTableRangeGapDetails:
        description: "Details about a routing table range gap inconsistency."
        strict: false
        fields:
            namespace:
                cpp_name: nss
                type: namespacestring
                description: "The namespace of the collection."
            collectionUUID:
                type: uuid
                description: "The UUID of the collection."
            chunkA:
                type: object
                description: "The first chunk that has a gap with the second chunk."
            chunkB:
                type: object
                description: "The second chunk that has a gap with the first chunk."

    RoutingTableMissingMinKeyDetails:
        description: "Details about a routing table missing min key inconsistency."
        strict: false
        fields:
            namespace:
                cpp_name: nss
                type: namespacestring
                description: "The namespace of the collection."
            collectionUUID:
                type: uuid
                description: "The UUID of the collection."
            minKeyObj:
                type: object
                description: "The min key of the collection."
            globalMin:
                type: object
                description: "The expected min key of the collection."

    RoutingTableMissingMaxKeyDetails:
        description: "Details about a routing table missing max key inconsistency."
        strict: false
        fields:
            namespace:
                cpp_name: nss
                type: namespacestring
                description: "The namespace of the collection."
            collectionUUID:
                type: uuid
                description: "The UUID of the collection."
            maxKeyObj:
                type: object
                description: "The max key of the collection."
            globalMax:
                type: object
                description: "The expected max key of the collection."

    CorruptedChunkShardKeyDetails:
        description: "Details about a corrupted chunk shard key inconsistency."
        strict: false
        fields:
            namespace:
                cpp_name: nss
                type: namespacestring
                description: "The namespace of the collection."
            collectionUUID:
                type: uuid
                description: "The UUID of the collection."
            chunk:
                type: object
                description: "The chunk with a corrupted shard key."
            shardKeyPattern:
                type: object
                description: "The shard key pattern of the collection."

    CorruptedZoneShardKeyDetails:
        description: "Details about a corrupted zone shard key inconsistency."
        strict: false
        fields:
            namespace:
                cpp_name: nss
                type: namespacestring
                description: "The namespace of the collection."
            collectionUUID:
                type: uuid
                description: "The UUID of the collection."
            zone:
                type: object
                description: "The zone with a corrupted shard key."
            shardKeyPattern:
                type: object
                description: "The shard key pattern of the collection."

    HiddenShardedCollectionDetails:
        description: "Details about a hidden sharded collection inconsistency."
        strict: false
        fields:
            namespace:
                cpp_name: nss
                type: namespacestring
                description: "The namespace of the collection that is hidden."
            collection:
                type: object
                description: "Information about the collection."

    InconsistentIndexDetails:
        description: "Details about index inconsistency."
        strict: false
        fields:
            namespace:
                cpp_name: nss
                type: namespacestring
                description: "The namespace of the affected collection."
            info:
                type: object
                description: "Object containing infos about the inconsistent index."

    MissingRoutingTableDetails:
        description: "Details about a missing routing table inconsistency."
        strict: false
        fields:
            namespace:
                cpp_name: nss
                type: namespacestring
                description: "The namespace of the collection that has no routing table."
            collectionUUID:
                type: uuid
                description: "The UUID of the collection."
    
    ShardThinksCollectionIsUnshardedDetails:
        description: "Details about shard that thinks collection is unsharded."
        strict: false
        fields:
            namespace:
                cpp_name: nss
                type: namespacestring
                description: "The namespace of the collection."
            collectionUUID:
                type: uuid
                description: "The UUID of the collection."
            shard:
                type: shard_id
                description: "The shard with wrong collection timestamp."

    ZonesRangeOverlapDetails:
        description: "Details about a zones range overlap inconsistency."
        strict: false
        fields:
            namespace:
                cpp_name: nss
                type: namespacestring
                description: "The namespace of the collection."
            collectionUUID:
                type: uuid
                description: "The UUID of the collection."
            zoneA:
                type: object
                description: "The first zone that overlaps with the second zone."
            zoneB:
                type: object
                description: "The second zone that overlaps with the first zone."

    MetadataInconsistencyItem:
        description: "Object representing a single metadata inconsistency found in a specific shard"
        strict: false
        fields:
            type:
                type: MetadataInconsistencyType
                description: "Type of the inconsistency."
            description:
                type: string
                description: "Description about the inconsistency."
            details:
                type: object
                description: "Details about the inconsistency."

    CommonCheckMetadataRequestFields:
        description: "Common fields for all checkMetdataConsistency commands"
        strict: false
        fields:
            # TODO SERVER-75675 remove this field and always perform index consistency checks
            checkIndexes:
                description: "Enable index consistency checks"
                type: safeBool
                optional: true