0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 01:21:03 +01:00
mongodb/jstests/hooks/run_check_repl_oplogs.js
2018-02-21 10:38:49 -05:00

22 lines
762 B
JavaScript

// Runner for checkOplogs() that compares the oplog on all replica set nodes
// to ensure all nodes have the same data.
'use strict';
(function() {
var startTime = Date.now();
assert.neq(typeof db, 'undefined', 'No `db` object, is the shell connected to a mongod?');
var primaryInfo = db.isMaster();
assert(primaryInfo.ismaster,
'shell is not connected to the primary or master node: ' + tojson(primaryInfo));
var cmdLineOpts = db.adminCommand('getCmdLineOpts');
assert.commandWorked(cmdLineOpts);
var testFixture = new ReplSetTest(db.getMongo().host);
testFixture.checkOplogs();
var totalTime = Date.now() - startTime;
print('Finished consistency oplog checks of cluster in ' + totalTime + ' ms.');
})();