blob: 50ca85f3f9a54717f13ad3bc674a02370d991d25 (
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
|
'use strict';
(function() {
load('jstests/libs/check_metadata_consistency_helpers.js'); // For MetadataConsistencyChecker.
load('jstests/libs/fixture_helpers.js'); // For FixtureHelpers.
assert.neq(typeof db, 'undefined', 'No `db` object, is the shell connected to a server?');
{
// Check that we are running on a sharded cluster
let isShardedCluster = false;
try {
isShardedCluster = FixtureHelpers.isMongos(db);
} catch (e) {
if (ErrorCodes.isRetriableError(e.code) || ErrorCodes.isInterruption(e.code)) {
jsTest.log(
`Aborted metadata consistency check due to retriable error during topology discovery: ${
e}`);
return;
} else {
throw e;
}
}
assert(isShardedCluster, "Metadata consistency check must be run against a sharded cluster");
}
const mongos = db.getMongo();
MetadataConsistencyChecker.run(mongos);
})();
|