diff options
21 files changed, 34 insertions, 39 deletions
diff --git a/jstests/sharding/authCommands.js b/jstests/sharding/authCommands.js index 258ec539c68..9bf86d47cc5 100644 --- a/jstests/sharding/authCommands.js +++ b/jstests/sharding/authCommands.js @@ -283,15 +283,14 @@ checkRemoveShard( false ); assert( adminDB.auth( rwUser, password ) ); assert( testDB.dropDatabase().ok ); checkRemoveShard( true ); -adminDB.printShardingStatus(); +st.printShardingStatus(); jsTestLog("Check adding a shard"); assert( adminDB.logout().ok ); checkAddShard( false ); assert( adminDB.auth( rwUser, password ) ); checkAddShard( true ); -adminDB.printShardingStatus(); - +st.printShardingStatus(); st.stop(); }; diff --git a/jstests/sharding/auth_add_shard.js b/jstests/sharding/auth_add_shard.js index 592a2443119..78db5dd28e6 100644 --- a/jstests/sharding/auth_add_shard.js +++ b/jstests/sharding/auth_add_shard.js @@ -73,7 +73,7 @@ assert.commandWorked(admin.runCommand({ moveChunk: "foo.bar", find: { _id: 1 }, admin.runCommand({ flushRouterConfig: 1 }); var config = mongos.getDB("config"); -config.printShardingStatus(true); +st.printShardingStatus(true); // start balancer before removing the shard st.startBalancer(); diff --git a/jstests/sharding/balance_tags2.js b/jstests/sharding/balance_tags2.js index 5f5697cadf9..0bcedf97e33 100644 --- a/jstests/sharding/balance_tags2.js +++ b/jstests/sharding/balance_tags2.js @@ -26,7 +26,7 @@ for (i = 0; i < 20; i++) { sh.startBalancer(); -sh.status(true); +s.printShardingStatus(true); // Wait for the initial balance to happen assert.soon(function() { @@ -48,7 +48,7 @@ assert.eq([ "a" ] , s.config.shards.findOne({ _id : "shard0000" }).tags); sh.addTagRange("test.foo", { _id : MinKey }, { _id : MaxKey }, "a"); // Wait for things to move to that one shard -sh.status(true); +s.printShardingStatus(true); assert.soon(function() { var counts = s.chunkCounts("foo"); @@ -60,6 +60,6 @@ assert.soon(function() { 1000 * 60 * 10, 1000); -printjson(sh.status()); +s.printShardingStatus(true); s.stop(); diff --git a/jstests/sharding/bouncing_count.js b/jstests/sharding/bouncing_count.js index cdd723f8a44..e148fae1ed6 100644 --- a/jstests/sharding/bouncing_count.js +++ b/jstests/sharding/bouncing_count.js @@ -43,7 +43,7 @@ for( var i = 0; i < shards.length; i++ ){ // Make sure mongos A is up-to-date mongosA.getDB("admin").runCommand({ flushRouterConfig : 1 }); -config.printShardingStatus( true ); +st.printShardingStatus(true); jsTestLog( "Running count!" ); diff --git a/jstests/sharding/explain_cmd.js b/jstests/sharding/explain_cmd.js index bf9ed176617..fa81dbf6b79 100644 --- a/jstests/sharding/explain_cmd.js +++ b/jstests/sharding/explain_cmd.js @@ -34,7 +34,7 @@ for (var i = 0; i < 3; i++) { collSharded.insert({_id: i, a: i, b: 1}); } -printjson(sh.status()); +st.printShardingStatus(); // Test a scatter-gather count command. assert.eq(3, collSharded.count({b: 1})); diff --git a/jstests/sharding/hash_shard1.js b/jstests/sharding/hash_shard1.js index b34179b7d6c..dc07f3e20f5 100644 --- a/jstests/sharding/hash_shard1.js +++ b/jstests/sharding/hash_shard1.js @@ -18,7 +18,7 @@ t.drop(); var res = db.adminCommand( { shardcollection : ns , key : { a : "hashed" } } ); assert.gt( s.config.chunks.count({ns:ns}), 3); assert.eq( res.ok , 1 , "shardcollection didn't work" ); -db.printShardingStatus(); +s.printShardingStatus(); // insert stuff var numitems = 1000; diff --git a/jstests/sharding/hash_shard_non_empty.js b/jstests/sharding/hash_shard_non_empty.js index 1dffb3a3243..47e2aa37e1b 100644 --- a/jstests/sharding/hash_shard_non_empty.js +++ b/jstests/sharding/hash_shard_non_empty.js @@ -15,7 +15,7 @@ db.getCollection(coll).insert({ a : 1 }); db.getCollection(coll).ensureIndex({ a: "hashed"}); var res = db.adminCommand({ shardcollection : dbname + "." + coll, key : { a : "hashed" } }); assert.eq(res.ok, 1, "shardcollection didn't work"); -db.printShardingStatus(); +s.printShardingStatus(); var numChunks = s.config.chunks.count(); assert.eq(numChunks, 1 , "sharding non-empty collection should not pre-split"); diff --git a/jstests/sharding/hash_shard_num_chunks.js b/jstests/sharding/hash_shard_num_chunks.js index 25ca0043295..ad32a080c70 100644 --- a/jstests/sharding/hash_shard_num_chunks.js +++ b/jstests/sharding/hash_shard_num_chunks.js @@ -16,7 +16,7 @@ assert.commandWorked(db.adminCommand({ shardcollection: dbname + "." + coll, key: { a: "hashed" }, numInitialChunks: 500 })); -db.printShardingStatus(); +s.printShardingStatus(); var numChunks = s.config.chunks.count(); assert.eq(numChunks, 500 , "should be exactly 500 chunks"); diff --git a/jstests/sharding/hash_shard_unique_compound.js b/jstests/sharding/hash_shard_unique_compound.js index eab3fd92c6c..25acfb87f48 100644 --- a/jstests/sharding/hash_shard_unique_compound.js +++ b/jstests/sharding/hash_shard_unique_compound.js @@ -19,7 +19,7 @@ var res = s.stopBalancer(); // shard a fresh collection using a hashed shard key coll.drop(); assert.commandWorked(db.adminCommand( { shardcollection : ns , key : { a : "hashed" } } )); -db.printShardingStatus(); +s.printShardingStatus(); // Create unique index assert.commandWorked(coll.ensureIndex({ a: 1, b: 1 }, { unique: true })); @@ -38,7 +38,7 @@ assert.commandWorked(coll.ensureIndex({ a: 1, b: 1 }, { unique: true })); assert.commandWorked(db.adminCommand( { shardcollection : ns , key : { a : "hashed" } } ), "shardcollection didn't worked 2"); -db.printShardingStatus(); +s.printShardingStatus(); jsTest.log("------ indexes 2-------"); jsTest.log(tojson(coll.getIndexes())); diff --git a/jstests/sharding/jumbo1.js b/jstests/sharding/jumbo1.js index 4c0b3593022..22b4004635e 100644 --- a/jstests/sharding/jumbo1.js +++ b/jstests/sharding/jumbo1.js @@ -28,13 +28,13 @@ for ( ; x < 2000; x++ ) assert.writeOK( bulk.execute() ); -sh.status(true); +s.printShardingStatus(true); res = sh.moveChunk( "test.foo" , { x : 0 } , "shard0001" ); if ( ! res.ok ) res = sh.moveChunk( "test.foo" , { x : 0 } , "shard0000" ); -sh.status(true); +s.printShardingStatus(true); sh.setBalancerState( true ); @@ -47,7 +47,7 @@ function diff1(){ assert.soon( function(){ var d = diff1(); print( "diff: " + d ); - sh.status(true); + s.printShardingStatus(true); return d < 5; } , "balance didn't happen" , 1000 * 60 * 5 , 5000 ); diff --git a/jstests/sharding/migrateBig.js b/jstests/sharding/migrateBig.js index 81961d9c2f5..6d58cb44449 100644 --- a/jstests/sharding/migrateBig.js +++ b/jstests/sharding/migrateBig.js @@ -22,13 +22,13 @@ for ( x=0; x<100; x++ ) { } assert.writeOK(bulk.execute()); -db.printShardingStatus(); +s.printShardingStatus(); s.adminCommand( { split : "test.foo" , middle : { x : 30 } } ); s.adminCommand( { split : "test.foo" , middle : { x : 66 } } ); s.adminCommand( { movechunk : "test.foo" , find : { x : 90 } , to : s.getOther( s.getServer( "test" ) ).name } ); -db.printShardingStatus(); +s.printShardingStatus(); print( "YO : " + s.getServer( "test" ).host ); direct = new Mongo( s.getServer( "test" ).host ); @@ -40,7 +40,7 @@ for ( done=0; done<2*1024*1024; done+=big.length ){ assert.writeOK(directDB.foo.insert( { x : 50 + Math.random() , big : big } )); } -db.printShardingStatus(); +s.printShardingStatus(); assert.throws( function(){ s.adminCommand( { movechunk : "test.foo" , find : { x : 50 } , to : s.getOther( s.getServer( "test" ) ).name } ); } , [] , "move should fail" ); @@ -55,7 +55,7 @@ for ( i=0; i<20; i+= 2 ) { } } -db.printShardingStatus(); +s.printShardingStatus(); s.config.settings.update( { _id: "balancer" }, { $set : { stopped: false } } , true ); diff --git a/jstests/sharding/mongos_no_detect_sharding.js b/jstests/sharding/mongos_no_detect_sharding.js index 9313ee8bccd..1e5c8832ac0 100644 --- a/jstests/sharding/mongos_no_detect_sharding.js +++ b/jstests/sharding/mongos_no_detect_sharding.js @@ -34,7 +34,7 @@ for( var i = 0; i < 100; i++ ){ } assert.writeOK(bulk.execute()); -config.printShardingStatus( true ); +st.printShardingStatus( true ); assert.eq( coll.getShardVersion().ok, 1 ); assert.eq( 101, coll.find().itcount() ); diff --git a/jstests/sharding/mrShardedOutput.js b/jstests/sharding/mrShardedOutput.js index 55b95386a7b..a4dac1db3d2 100644 --- a/jstests/sharding/mrShardedOutput.js +++ b/jstests/sharding/mrShardedOutput.js @@ -67,7 +67,7 @@ assert.gt(newNumChunks, 1, var objSize = Object.bsonsize(testDB.mrShardedOut.findOne()); var docsPerChunk = 1024 * 1024 / objSize * 1.1; // 1MB chunk size + allowance -printShardingStatus(config, true); +st.printShardingStatus(true); config.chunks.find({ ns: testDB.mrShardedOut.getFullName() }).forEach(function(chunkDoc) { var count = testDB.mrShardedOut.find({ _id: { $gte: chunkDoc.min._id, @@ -123,7 +123,7 @@ newNumChunks = config.chunks.count({ns: testDB.mrShardedOut._fullName}); assert.gt(newNumChunks, 1, "Sharding FAILURE: " + testDB.mrShardedOut._fullName + " has only 1 chunk"); -printShardingStatus(config, true); +st.printShardingStatus(true); // TODO: fix SERVER-12581 /* diff --git a/jstests/sharding/mrShardedOutputAuth.js b/jstests/sharding/mrShardedOutputAuth.js index a59367f158d..ed88e34aeed 100644 --- a/jstests/sharding/mrShardedOutputAuth.js +++ b/jstests/sharding/mrShardedOutputAuth.js @@ -34,13 +34,11 @@ function doMapReduce(connection, outputDb) { } function assertSuccess(configDb, outputDb) { - adminDb.printShardingStatus(); assert.eq(outputDb.numbers_out.count(), 50, "map/reduce failed"); assert( ! configDb.collections.findOne().dropped, "no sharded collections"); } function assertFailure(configDb, outputDb) { - adminDb.printShardingStatus(); assert.eq(outputDb.numbers_out.count(), 0, "map/reduce should not have succeeded"); } diff --git a/jstests/sharding/prefix_shard_key.js b/jstests/sharding/prefix_shard_key.js index 1528e2a35af..a473be73cb4 100644 --- a/jstests/sharding/prefix_shard_key.js +++ b/jstests/sharding/prefix_shard_key.js @@ -189,7 +189,7 @@ for( i=0; i < 3; i++ ){ // and check total assert.eq( 25 , coll2.find().itcount() , "bad total number of docs after move" ); - db.printShardingStatus(); + s.printShardingStatus(); } s.stop(); diff --git a/jstests/sharding/remove2.js b/jstests/sharding/remove2.js index 76d02df38b9..08af78404dd 100644 --- a/jstests/sharding/remove2.js +++ b/jstests/sharding/remove2.js @@ -122,7 +122,7 @@ assert.soon( function() { assert.eq( 300, coll.find().itcount() ); -st.admin.printShardingStatus(); +st.printShardingStatus(); // Remove shard and add it back in, without shutting it down. jsTestLog( "Attempting to remove shard and add it back in" ); diff --git a/jstests/sharding/sharding_rs2.js b/jstests/sharding/sharding_rs2.js index b60910d3fb9..d872c72e9e4 100644 --- a/jstests/sharding/sharding_rs2.js +++ b/jstests/sharding/sharding_rs2.js @@ -137,7 +137,7 @@ s.stopBalancer(); assert.eq(100, t.count(), "C2"); assert.commandWorked(s.s0.adminCommand({ split: "test.foo", middle: { x: 50 } })); -db.printShardingStatus(); +s.printShardingStatus(); var other = s.config.shards.findOne({ _id: { $ne: serverName } }); assert.commandWorked(s.getDB('admin').runCommand({ moveChunk: "test.foo", @@ -175,7 +175,7 @@ assert.lte(before.query + 10, after.query, "D3"); m = new Mongo(s.s.name); m.forceWriteMode("commands"); -db.printShardingStatus(); +s.printShardingStatus(); ts = m.getDB("test").foo; diff --git a/jstests/sharding/sharding_system_namespaces.js b/jstests/sharding/sharding_system_namespaces.js index 06129357f92..3cdcc11775e 100644 --- a/jstests/sharding/sharding_system_namespaces.js +++ b/jstests/sharding/sharding_system_namespaces.js @@ -52,7 +52,7 @@ if (Array.contains(storageEngines, "wiredTiger")) { assert.commandWorked(db.adminCommand({ split: coll + '', middle: { x: 5 }})); - printShardingStatus(); + st.printShardingStatus(); var primaryShard = st.getServer("test"); anotherShard = st.getOther( primaryShard ); @@ -62,7 +62,7 @@ if (Array.contains(storageEngines, "wiredTiger")) { to: anotherShard.name })); - printShardingStatus(); + st.printShardingStatus(); checkCollectionOptions(anotherShard.getDB("test")); } diff --git a/jstests/sharding/tag_auto_split.js b/jstests/sharding/tag_auto_split.js index c138fc788fa..835ec3b1546 100644 --- a/jstests/sharding/tag_auto_split.js +++ b/jstests/sharding/tag_auto_split.js @@ -20,11 +20,10 @@ sh.addTagRange( "test.foo" , { _id : 5 } , { _id : 10 } , "a" ); sh.addTagRange( "test.foo" , { _id : 10 } , { _id : 15 } , "b" ); assert.soon( function() { - //printjson( sh.status() ); return s.config.chunks.count() == 3; }, "things didn't get split", 1000 * 60 * 10, 1000 ); -printjson( sh.status() ); +s.printShardingStatus(); s.stop(); @@ -48,7 +47,6 @@ sh.addTagRange( "test.foo" , { _id : 5 } , { _id : 10 } , "a" ); sh.addTagRange( "test.foo" , { _id : 10 } , { _id : 15 } , "b" ); assert.soon( function() { - //printjson( sh.status() ); return s.config.chunks.count() == 3; }, "things didn't get split", 1000 * 60 * 10, 1000 ); diff --git a/jstests/slow1/sharding_multiple_collections.js b/jstests/slow1/sharding_multiple_collections.js index 25bf8353ceb..b844fe6c9dd 100644 --- a/jstests/slow1/sharding_multiple_collections.js +++ b/jstests/slow1/sharding_multiple_collections.js @@ -25,7 +25,7 @@ for ( i=0; i<N; i++ ){ assert.writeOK(bulk.execute()); assert.writeOK(bulk2.execute()); -db.printShardingStatus(); +s.printShardingStatus(); function mytest( coll , i , loopNumber ){ x = coll.find( { _id : i } ).explain(); @@ -42,7 +42,7 @@ while ( 1 ){ if ( i % 1000 == 0 ) print( i ); } - db.printShardingStatus(); + s.printShardingStatus(); loopNumber++; if ( loopNumber == 1 ){ diff --git a/src/mongo/shell/shardingtest.js b/src/mongo/shell/shardingtest.js index 7b3d5a440ae..7e5ded35ca6 100644 --- a/src/mongo/shell/shardingtest.js +++ b/src/mongo/shell/shardingtest.js @@ -361,8 +361,8 @@ var ShardingTest = function(params) { print("ShardingTest " + this.getChunksString(ns)); }; - this.printShardingStatus = function() { - printShardingStatus(this.config); + this.printShardingStatus = function(verbose) { + printShardingStatus(this.config, verbose); }; this.printCollectionInfo = function(ns, msg) { |