summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Grundy <michael.grundy@10gen.com>2016-02-04 12:29:33 -0500
committerMike Grundy <michael.grundy@10gen.com>2016-02-05 15:00:50 -0500
commit4fff5009ab22466f8780ce727b9fbf1992f0db62 (patch)
treeaad664d6a077b2845589b71c6d6d12dca499b235
parentb56e96fdb89aa9f036901b9653bf900595c1956a (diff)
downloadmongo-4fff5009ab22466f8780ce727b9fbf1992f0db62.tar.gz
SERVER-22341 fix jslint errors in jstests/libs with eslint --fix
-rw-r--r--jstests/libs/cleanup_orphaned_util.js2
-rw-r--r--jstests/libs/geo_near_random.js28
-rw-r--r--jstests/libs/override_methods/set_majority_read_and_write_concerns.js6
-rw-r--r--jstests/libs/override_methods/sharding_continuous_config_stepdown.js4
-rw-r--r--jstests/libs/parallelTester.js44
-rw-r--r--jstests/libs/slow_weekly_util.js2
-rw-r--r--jstests/libs/test_background_ops.js244
-rw-r--r--jstests/libs/trace_missing_docs.js2
8 files changed, 166 insertions, 166 deletions
diff --git a/jstests/libs/cleanup_orphaned_util.js b/jstests/libs/cleanup_orphaned_util.js
index ffc13c107d6..912a4506c90 100644
--- a/jstests/libs/cleanup_orphaned_util.js
+++ b/jstests/libs/cleanup_orphaned_util.js
@@ -25,7 +25,7 @@ function cleanupOrphaned(shardConnection, ns, expectedIterations) {
assert.eq(iterations, expectedIterations, 'Expected to run ' +
'cleanupOrphaned' + expectedIterations + ' times, but it only ran ' +
- iterations + ' times before stoppedAtKey was null.')
+ iterations + ' times before stoppedAtKey was null.');
}
// Shards data from key range, then inserts orphan documents, runs cleanupOrphans
diff --git a/jstests/libs/geo_near_random.js b/jstests/libs/geo_near_random.js
index 27590322b7a..fa2811e506d 100644
--- a/jstests/libs/geo_near_random.js
+++ b/jstests/libs/geo_near_random.js
@@ -8,7 +8,7 @@ GeoNearRandomTest = function(name) {
Random.srand(1234);
print("starting test: " + name);
-}
+};
GeoNearRandomTest.prototype.mkPt = function mkPt(scale, indexBounds){
@@ -23,7 +23,7 @@ GeoNearRandomTest.prototype.mkPt = function mkPt(scale, indexBounds){
return [( Random.rand() * (range - eps) + eps) + indexBounds.min, ( Random.rand() * (range - eps) + eps ) + indexBounds.min];
}
-}
+};
GeoNearRandomTest.prototype.insertPts = function(nPts, indexBounds, scale) {
assert.eq(this.nPts, 0, "insertPoints already called");
@@ -38,23 +38,23 @@ GeoNearRandomTest.prototype.insertPts = function(nPts, indexBounds, scale) {
if(!indexBounds)
this.t.ensureIndex({loc: '2d'});
else
- this.t.ensureIndex({loc: '2d'}, indexBounds)
-}
+ this.t.ensureIndex({loc: '2d'}, indexBounds);
+};
GeoNearRandomTest.prototype.assertIsPrefix = function(short, long) {
for (var i=0; i < short.length; i++){
- var xS = short[i].obj ? short[i].obj.loc[0] : short[i].loc[0]
- var yS = short[i].obj ? short[i].obj.loc[1] : short[i].loc[1]
- var dS = short[i].obj ? short[i].dis : 1
+ var xS = short[i].obj ? short[i].obj.loc[0] : short[i].loc[0];
+ var yS = short[i].obj ? short[i].obj.loc[1] : short[i].loc[1];
+ var dS = short[i].obj ? short[i].dis : 1;
- var xL = long[i].obj ? long[i].obj.loc[0] : long[i].loc[0]
- var yL = long[i].obj ? long[i].obj.loc[1] : long[i].loc[1]
- var dL = long[i].obj ? long[i].dis : 1
+ var xL = long[i].obj ? long[i].obj.loc[0] : long[i].loc[0];
+ var yL = long[i].obj ? long[i].obj.loc[1] : long[i].loc[1];
+ var dL = long[i].obj ? long[i].dis : 1;
assert.eq([xS, yS, dS], [xL, yL, dL]);
}
-}
+};
GeoNearRandomTest.prototype.testPt = function(pt, opts) {
assert.neq(this.nPts, 0, "insertPoints not yet called");
@@ -71,7 +71,7 @@ GeoNearRandomTest.prototype.testPt = function(pt, opts) {
var last = db.runCommand(cmd).results;
for (var i=2; i <= opts.nToTest; i++){
//print(i); // uncomment to watch status
- cmd.num = i
+ cmd.num = i;
var ret = db.runCommand(cmd).results;
try {
@@ -90,7 +90,7 @@ GeoNearRandomTest.prototype.testPt = function(pt, opts) {
if (!opts.sharded){
- last = last.map(function(x){return x.obj});
+ last = last.map(function(x){return x.obj;});
var query = {loc:{}};
query.loc[ opts.sphere ? '$nearSphere' : '$near' ] = pt;
@@ -99,6 +99,6 @@ GeoNearRandomTest.prototype.testPt = function(pt, opts) {
this.assertIsPrefix(last, near);
assert.eq(last, near);
}
-}
+};
diff --git a/jstests/libs/override_methods/set_majority_read_and_write_concerns.js b/jstests/libs/override_methods/set_majority_read_and_write_concerns.js
index edb07c69fbb..2e11323a9a9 100644
--- a/jstests/libs/override_methods/set_majority_read_and_write_concerns.js
+++ b/jstests/libs/override_methods/set_majority_read_and_write_concerns.js
@@ -13,13 +13,13 @@
if (typeof(jsCode) === "function") {
// Load the override file and immediately invoke the supplied function.
- newCode = `load("${overridesFile}"); (${jsCode})();`
+ newCode = `load("${overridesFile}"); (${jsCode})();`;
} else {
- newCode = `load("${overridesFile}"); ${jsCode};`
+ newCode = `load("${overridesFile}"); ${jsCode};`;
}
return originalStartParallelShell(newCode, port, noConnect);
- }
+ };
DB.prototype._runCommandImpl = function(dbName, obj, options) {
var cmdName = "";
diff --git a/jstests/libs/override_methods/sharding_continuous_config_stepdown.js b/jstests/libs/override_methods/sharding_continuous_config_stepdown.js
index 017488f06ff..376fd810570 100644
--- a/jstests/libs/override_methods/sharding_continuous_config_stepdown.js
+++ b/jstests/libs/override_methods/sharding_continuous_config_stepdown.js
@@ -94,7 +94,7 @@ ReplSetTest = function ReplSetTestWithContinuousPrimaryStepdown() {
}
options.verbose = 2;
return _originalStartSetFn.call(this, options);
- }
+ };
/**
* Overrides the stopSet call so it terminates the failover thread.
@@ -179,7 +179,7 @@ ShardingTest = function ShardingTestWithContinuousConfigPrimaryStepdown() {
*/
this.printShardingStatus = function() {
- }
+ };
// Start the continuous config server stepdown thread
this.configRS.startContinuousFailover();
diff --git a/jstests/libs/parallelTester.js b/jstests/libs/parallelTester.js
index cb5fb085a94..743d15b9825 100644
--- a/jstests/libs/parallelTester.js
+++ b/jstests/libs/parallelTester.js
@@ -4,12 +4,12 @@
if (typeof _threadInject != "undefined") {
Thread = function(){
this.init.apply( this, arguments );
- }
+ };
_threadInject( Thread.prototype );
ScopedThread = function() {
this.init.apply( this, arguments );
- }
+ };
ScopedThread.prototype = new Thread( function() {} );
_scopedThreadInject( ScopedThread.prototype );
@@ -17,48 +17,48 @@ if (typeof _threadInject != "undefined") {
var t = new Thread( function() {} );
Thread.apply( t, arguments );
return t;
- }
+ };
// Helper class to generate a list of events which may be executed by a ParallelTester
EventGenerator = function( me, collectionName, mean, host ) {
this.mean = mean;
if (host == undefined) host = db.getMongo().host;
this.events = new Array( me, collectionName, host );
- }
+ };
EventGenerator.prototype._add = function( action ) {
this.events.push( [ Random.genExp( this.mean ), action ] );
- }
+ };
EventGenerator.prototype.addInsert = function( obj ) {
this._add( "t.insert( " + tojson( obj ) + " )" );
- }
+ };
EventGenerator.prototype.addRemove = function( obj ) {
this._add( "t.remove( " + tojson( obj ) + " )" );
- }
+ };
EventGenerator.prototype.addUpdate = function( objOld, objNew ) {
this._add( "t.update( " + tojson( objOld ) + ", " + tojson( objNew ) + " )" );
- }
+ };
EventGenerator.prototype.addCheckCount = function( count, query, shouldPrint, checkQuery ) {
query = query || {};
shouldPrint = shouldPrint || false;
checkQuery = checkQuery || false;
- var action = "assert.eq( " + count + ", t.count( " + tojson( query ) + " ) );"
+ var action = "assert.eq( " + count + ", t.count( " + tojson( query ) + " ) );";
if ( checkQuery ) {
- action += " assert.eq( " + count + ", t.find( " + tojson( query ) + " ).toArray().length );"
+ action += " assert.eq( " + count + ", t.find( " + tojson( query ) + " ).toArray().length );";
}
if ( shouldPrint ) {
action += " print( me + ' ' + " + count + " );";
}
this._add( action );
- }
+ };
EventGenerator.prototype.getEvents = function() {
return this.events;
- }
+ };
EventGenerator.dispatch = function() {
var args = argumentsToArray( arguments );
@@ -71,25 +71,25 @@ if (typeof _threadInject != "undefined") {
sleep( args[ i ][ 0 ] );
eval( args[ i ][ 1 ] );
}
- }
+ };
// Helper class for running tests in parallel. It assembles a set of tests
// and then calls assert.parallelests to run them.
ParallelTester = function() {
- assert.neq(db.getMongo().writeMode(), "legacy", "wrong shell write mode")
+ assert.neq(db.getMongo().writeMode(), "legacy", "wrong shell write mode");
this.params = new Array();
- }
+ };
ParallelTester.prototype.add = function( fun, args ) {
args = args || [];
args.unshift( fun );
this.params.push( args );
- }
+ };
ParallelTester.prototype.run = function( msg, newScopes ) {
newScopes = newScopes || false;
assert.parallelTests( this.params, msg, newScopes );
- }
+ };
// creates lists of tests from jstests dir in a format suitable for use by
// ParallelTester.fileTester. The lists will be in random order.
@@ -106,7 +106,7 @@ if (typeof _threadInject != "undefined") {
ret[ a[ i ] ] = 1;
}
return ret;
- }
+ };
// some tests can't run in parallel with most others
var skipTests = makeKeys([ "repair.js",
@@ -205,7 +205,7 @@ if (typeof _threadInject != "undefined") {
}
return params;
- }
+ };
// runs a set of test files
// first argument is an identifier for this tester, remaining arguments are file names
@@ -219,7 +219,7 @@ if (typeof _threadInject != "undefined") {
print(" S" + suite + " Test : " + x + " " + time + "ms" );
}
);
- }
+ };
// params: array of arrays, each element of which consists of a function followed
// by zero or more arguments to that function. Each function and its arguments will
@@ -247,7 +247,7 @@ if (typeof _threadInject != "undefined") {
"}"
);
return z;
- }
+ };
var runners = new Array();
for( var i in params ) {
var param = params[ i ];
@@ -266,7 +266,7 @@ if (typeof _threadInject != "undefined") {
// (see SERVER-19615 for a similar issue).
runners.forEach( function( x ) { if( !x.returnData() ) { ++nFailed; } } );
assert.eq( 0, nFailed, msg );
- }
+ };
}
if ( typeof CountDownLatch !== 'undefined' ) {
diff --git a/jstests/libs/slow_weekly_util.js b/jstests/libs/slow_weekly_util.js
index 69b8fb27624..ba0c6a78229 100644
--- a/jstests/libs/slow_weekly_util.js
+++ b/jstests/libs/slow_weekly_util.js
@@ -9,7 +9,7 @@ SlowWeeklyMongod = function( name ) {
SlowWeeklyMongod.prototype.getDB = function( name ) {
return this.conn.getDB( name );
-}
+};
SlowWeeklyMongod.prototype.stop = function(){
MongoRunner.stopMongod( this.conn );
diff --git a/jstests/libs/test_background_ops.js b/jstests/libs/test_background_ops.js
index fa634816733..7adf41e9780 100644
--- a/jstests/libs/test_background_ops.js
+++ b/jstests/libs/test_background_ops.js
@@ -7,75 +7,75 @@
*/
var waitForLock = function( mongo, name ){
- var ts = new ObjectId()
- var lockColl = mongo.getCollection( "config.testLocks" )
+ var ts = new ObjectId();
+ var lockColl = mongo.getCollection( "config.testLocks" );
- lockColl.update({ _id : name, state : 0 }, { $set : { state : 0 } }, true)
+ lockColl.update({ _id : name, state : 0 }, { $set : { state : 0 } }, true);
//
// Wait until we can set the state to 1 with our id
//
- var startTime = new Date().getTime()
+ var startTime = new Date().getTime();
assert.soon( function() {
- lockColl.update({ _id : name, state : 0 }, { $set : { ts : ts, state : 1 } })
- var gleObj = lockColl.getDB().getLastErrorObj()
+ lockColl.update({ _id : name, state : 0 }, { $set : { ts : ts, state : 1 } });
+ var gleObj = lockColl.getDB().getLastErrorObj();
if( new Date().getTime() - startTime > 20 * 1000 ){
- print( "Waiting for..." )
- printjson( gleObj )
- printjson( lockColl.findOne() )
- printjson( ts )
+ print( "Waiting for..." );
+ printjson( gleObj );
+ printjson( lockColl.findOne() );
+ printjson( ts );
}
- return gleObj.n == 1 || gleObj.updatedExisting
- }, "could not acquire lock", 30 * 1000, 100 )
+ return gleObj.n == 1 || gleObj.updatedExisting;
+ }, "could not acquire lock", 30 * 1000, 100 );
print( "Acquired lock " + tojson( { _id : name, ts : ts } ) + " curr : " +
- tojson( lockColl.findOne({ _id : name }) ) )
+ tojson( lockColl.findOne({ _id : name }) ) );
// Set the state back to 0
var unlock = function(){
print( "Releasing lock " + tojson( { _id : name, ts : ts } ) + " curr : " +
- tojson( lockColl.findOne({ _id : name }) ) )
- lockColl.update({ _id : name, ts : ts }, { $set : { state : 0 } })
- }
+ tojson( lockColl.findOne({ _id : name }) ) );
+ lockColl.update({ _id : name, ts : ts }, { $set : { state : 0 } });
+ };
// Return an object we can invoke unlock on
- return { unlock : unlock }
-}
+ return { unlock : unlock };
+};
/**
* Allows a test or background op to say it's finished
*/
var setFinished = function( mongo, name, finished ){
if( finished || finished == undefined )
- mongo.getCollection( "config.testFinished" ).update({ _id : name }, { _id : name }, true )
+ mongo.getCollection( "config.testFinished" ).update({ _id : name }, { _id : name }, true );
else
- mongo.getCollection( "config.testFinished" ).remove({ _id : name })
-}
+ mongo.getCollection( "config.testFinished" ).remove({ _id : name });
+};
/**
* Checks whether a test or background op is finished
*/
var isFinished = function( mongo, name ){
- return mongo.getCollection( "config.testFinished" ).findOne({ _id : name }) != null
-}
+ return mongo.getCollection( "config.testFinished" ).findOne({ _id : name }) != null;
+};
/**
* Sets the result of a background op
*/
var setResult = function( mongo, name, result, err ){
- mongo.getCollection( "config.testResult" ).update({ _id : name }, { _id : name, result : result, err : err }, true )
-}
+ mongo.getCollection( "config.testResult" ).update({ _id : name }, { _id : name, result : result, err : err }, true );
+};
/**
* Gets the result for a background op
*/
var getResult = function( mongo, name ){
- return mongo.getCollection( "config.testResult" ).findOne({ _id : name })
-}
+ return mongo.getCollection( "config.testResult" ).findOne({ _id : name });
+};
/**
* Overrides the parallel shell code in mongo
@@ -90,21 +90,21 @@ function startParallelShell( jsCode, port ){
}
return function(){
- jsTestLog( "Waiting for shell " + x + "..." )
+ jsTestLog( "Waiting for shell " + x + "..." );
waitProgram( x );
- jsTestLog( "Shell " + x + " finished." )
+ jsTestLog( "Shell " + x + " finished." );
};
}
startParallelOps = function( mongo, proc, args, context ){
- var procName = proc.name + "-" + new ObjectId()
+ var procName = proc.name + "-" + new ObjectId();
var seed = new ObjectId( new ObjectId().valueOf().split("").reverse().join("") )
- .getTimestamp().getTime()
+ .getTimestamp().getTime();
// Make sure we aren't finished before we start
- setFinished( mongo, procName, false )
- setResult( mongo, procName, undefined, undefined )
+ setFinished( mongo, procName, false );
+ setResult( mongo, procName, undefined, undefined );
// TODO: Make this a context of its own
var procContext = { procName : procName,
@@ -117,65 +117,65 @@ startParallelOps = function( mongo, proc, args, context ){
setup : function( context, stored ){
waitForLock = function(){
- return context.waitForLock( db.getMongo(), context.procName )
- }
+ return context.waitForLock( db.getMongo(), context.procName );
+ };
setFinished = function( finished ){
- return context.setFinished( db.getMongo(), context.procName, finished )
- }
+ return context.setFinished( db.getMongo(), context.procName, finished );
+ };
isFinished = function(){
- return context.isFinished( db.getMongo(), context.procName )
- }
+ return context.isFinished( db.getMongo(), context.procName );
+ };
setResult = function( result, err ){
- return context.setResult( db.getMongo(), context.procName, result, err )
- }
- }}
+ return context.setResult( db.getMongo(), context.procName, result, err );
+ };
+ }};
var bootstrapper = function( stored ){
- var procContext = stored.procContext
- procContext.setup( procContext, stored )
+ var procContext = stored.procContext;
+ procContext.setup( procContext, stored );
- var contexts = stored.contexts
- eval( "contexts = " + contexts )
+ var contexts = stored.contexts;
+ eval( "contexts = " + contexts );
for( var i = 0; i < contexts.length; i++ ){
if( typeof( contexts[i] ) != "undefined" ){
// Evaluate all contexts
- contexts[i]( procContext )
+ contexts[i]( procContext );
}
}
- var operation = stored.operation
- eval( "operation = " + operation )
+ var operation = stored.operation;
+ eval( "operation = " + operation );
- var args = stored.args
- eval( "args = " + args )
+ var args = stored.args;
+ eval( "args = " + args );
- result = undefined
- err = undefined
+ result = undefined;
+ err = undefined;
try{
- result = operation.apply( null, args )
+ result = operation.apply( null, args );
}
catch( e ){
- err = e
+ err = e;
}
- setResult( result, err )
- }
+ setResult( result, err );
+ };
- var contexts = [ RandomFunctionContext, context ]
+ var contexts = [ RandomFunctionContext, context ];
- var testDataColl = mongo.getCollection( "config.parallelTest" )
+ var testDataColl = mongo.getCollection( "config.parallelTest" );
testDataColl.insert({ _id : procName,
bootstrapper : tojson( bootstrapper ),
operation : tojson( proc ),
args : tojson( args ),
procContext : procContext,
- contexts : tojson( contexts ) })
+ contexts : tojson( contexts ) });
- assert.eq( null, testDataColl.getDB().getLastError() )
+ assert.eq( null, testDataColl.getDB().getLastError() );
var bootstrapStartup =
"{ var procName = '" + procName + "'; " +
@@ -184,7 +184,7 @@ startParallelOps = function( mongo, proc, args, context ){
"var bootstrapper = stored.bootstrapper; " +
"eval( 'bootstrapper = ' + bootstrapper ); " +
"bootstrapper( stored ); " +
- "}"
+ "}";
// Save the global db object if it exists, so that we can restore it after starting the parallel
// shell.
@@ -192,94 +192,94 @@ startParallelOps = function( mongo, proc, args, context ){
if (typeof db !== 'undefined') {
oldDB = db;
}
- db = mongo.getDB( "test" )
+ db = mongo.getDB( "test" );
- jsTest.log( "Starting " + proc.name + " operations..." )
+ jsTest.log( "Starting " + proc.name + " operations..." );
- var rawJoin = startParallelShell( bootstrapStartup )
+ var rawJoin = startParallelShell( bootstrapStartup );
- db = oldDB
+ db = oldDB;
var join = function(){
- setFinished( mongo, procName, true )
+ setFinished( mongo, procName, true );
rawJoin();
- result = getResult( mongo, procName )
+ result = getResult( mongo, procName );
- assert.neq( result, null )
+ assert.neq( result, null );
if( result.err ) throw Error("Error in parallel ops " + procName + " : "
- + tojson( result.err ) )
+ + tojson( result.err ) );
- else return result.result
- }
+ else return result.result;
+ };
join.isFinished = function(){
- return isFinished( mongo, procName )
- }
+ return isFinished( mongo, procName );
+ };
join.setFinished = function( finished ){
- return setFinished( mongo, procName, finished )
- }
+ return setFinished( mongo, procName, finished );
+ };
join.waitForLock = function( name ){
- return waitForLock( mongo, name )
- }
+ return waitForLock( mongo, name );
+ };
- return join
-}
+ return join;
+};
var RandomFunctionContext = function( context ){
Random.srand( context.seed );
- Random.randBool = function(){ return Random.rand() > 0.5 }
+ Random.randBool = function(){ return Random.rand() > 0.5; };
Random.randInt = function( min, max ){
if( max == undefined ){
- max = min
- min = 0
+ max = min;
+ min = 0;
}
- return min + Math.floor( Random.rand() * max )
- }
+ return min + Math.floor( Random.rand() * max );
+ };
Random.randShardKey = function(){
- var numFields = 2 //Random.randInt(1, 3)
+ var numFields = 2; //Random.randInt(1, 3)
- var key = {}
+ var key = {};
for( var i = 0; i < numFields; i++ ){
- var field = String.fromCharCode( "a".charCodeAt() + i )
- key[ field ] = 1
+ var field = String.fromCharCode( "a".charCodeAt() + i );
+ key[ field ] = 1;
}
- return key
- }
+ return key;
+ };
Random.randShardKeyValue = function( shardKey ){
- var keyValue = {}
+ var keyValue = {};
for( field in shardKey ){
- keyValue[ field ] = Random.randInt(1, 100)
+ keyValue[ field ] = Random.randInt(1, 100);
}
- return keyValue
- }
+ return keyValue;
+ };
Random.randCluster = function(){
- var numShards = 2 //Random.randInt( 1, 10 )
- var rs = false //Random.randBool()
+ var numShards = 2; //Random.randInt( 1, 10 )
+ var rs = false; //Random.randBool()
var st = new ShardingTest({ shards : numShards,
mongos : 4,
- other : { rs : rs } })
+ other : { rs : rs } });
- return st
- }
-}
+ return st;
+ };
+};
//
@@ -288,57 +288,57 @@ var RandomFunctionContext = function( context ){
function moveOps( collName, options ){
- options = options || {}
+ options = options || {};
- var admin = db.getMongo().getDB( "admin" )
- var config = db.getMongo().getDB( "config" )
- var shards = config.shards.find().toArray()
- var shardKey = config.collections.findOne({ _id : collName }).key
+ var admin = db.getMongo().getDB( "admin" );
+ var config = db.getMongo().getDB( "config" );
+ var shards = config.shards.find().toArray();
+ var shardKey = config.collections.findOne({ _id : collName }).key;
while( ! isFinished() ){
- var findKey = Random.randShardKeyValue( shardKey )
- var toShard = shards[ Random.randInt( shards.length ) ]._id
+ var findKey = Random.randShardKeyValue( shardKey );
+ var toShard = shards[ Random.randInt( shards.length ) ]._id;
try {
printjson( admin.runCommand({ moveChunk : collName,
find : findKey,
- to : toShard }) )
+ to : toShard }) );
}
catch( e ){
- printjson( e )
+ printjson( e );
}
- sleep( 1000 )
+ sleep( 1000 );
}
- jsTest.log( "Stopping moveOps..." )
+ jsTest.log( "Stopping moveOps..." );
}
function splitOps( collName, options ){
- options = options || {}
+ options = options || {};
- var admin = db.getMongo().getDB( "admin" )
- var config = db.getMongo().getDB( "config" )
- var shards = config.shards.find().toArray()
- var shardKey = config.collections.findOne({ _id : collName }).key
+ var admin = db.getMongo().getDB( "admin" );
+ var config = db.getMongo().getDB( "config" );
+ var shards = config.shards.find().toArray();
+ var shardKey = config.collections.findOne({ _id : collName }).key;
while( ! isFinished() ){
- var middleKey = Random.randShardKeyValue( shardKey )
+ var middleKey = Random.randShardKeyValue( shardKey );
try {
printjson( admin.runCommand({ split : collName,
- middle : middleKey }) )
+ middle : middleKey }) );
}
catch( e ){
- printjson( e )
+ printjson( e );
}
- sleep( 1000 )
+ sleep( 1000 );
}
- jsTest.log( "Stopping splitOps..." )
+ jsTest.log( "Stopping splitOps..." );
}
diff --git a/jstests/libs/trace_missing_docs.js b/jstests/libs/trace_missing_docs.js
index 0a939f4d8d9..c70798fe99b 100644
--- a/jstests/libs/trace_missing_docs.js
+++ b/jstests/libs/trace_missing_docs.js
@@ -75,7 +75,7 @@ function traceMissingDoc( coll, doc, mongos ) {
var compareOps = function( opA, opB ) {
return bsonWoCompare( opA.ts, opB.ts );
- }
+ };
allOps.sort( compareOps );