summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-08-24 10:10:11 -0400
committerEliot Horowitz <eliot@10gen.com>2009-08-24 10:10:11 -0400
commitfd2155d554acbe12da09c525be1da108ab1dcbfc (patch)
tree0b63c9e7a8a8badbfad68c4cd3b63514c7cb75f1
parentb078f98360c7ce7f4699c8938cc4fd77d0e71b97 (diff)
downloadmongo-fd2155d554acbe12da09c525be1da108ab1dcbfc.tar.gz
fallotu from removing methods from Array
-rw-r--r--jstests/sharding/auto1.js4
-rw-r--r--jstests/sharding/auto2.js4
-rw-r--r--jstests/sharding/key_string.js2
-rw-r--r--jstests/sharding/shard2.js2
-rw-r--r--jstests/sharding/shard4.js2
-rw-r--r--jstests/sharding/shard5.js2
-rw-r--r--jstests/sharding/splitpick.js2
-rw-r--r--shell/servers.js8
8 files changed, 17 insertions, 9 deletions
diff --git a/jstests/sharding/auto1.js b/jstests/sharding/auto1.js
index 442ede5ec1c..15fcf534ec1 100644
--- a/jstests/sharding/auto1.js
+++ b/jstests/sharding/auto1.js
@@ -38,14 +38,14 @@ for ( ; i<1500; i++ ){
}
assert.eq( 3 , s.config.shard.count() , "shard didn't split A " );
-print( s.config.shard.find().toArray().tojson( "\n" ) );
+s.printShards();
for ( ; i<3000; i++ ){
coll.save( { num : i , s : bigString } );
}
assert.eq( 4 , s.config.shard.count() , "shard didn't split B " );
-print( s.config.shard.find().toArray().tojson( "\n" ) );
+s.printShards();
s.stop();
diff --git a/jstests/sharding/auto2.js b/jstests/sharding/auto2.js
index 497ee84dbcf..d81f02a3000 100644
--- a/jstests/sharding/auto2.js
+++ b/jstests/sharding/auto2.js
@@ -31,7 +31,7 @@ s.adminCommand( "connpoolsync" );
print( "done inserting data" );
print( "datasize: " + tojson( s.getServer( "test" ).getDB( "admin" ).runCommand( { datasize : "test.foo" } ) ) );
-print( s.config.shard.find().toArray().tojson( "\n" ) );
+s.printShards();
counta = s._connections[0].getDB( "test" ).foo.count();
countb = s._connections[1].getDB( "test" ).foo.count();
@@ -39,6 +39,6 @@ countb = s._connections[1].getDB( "test" ).foo.count();
assert.eq( j * 100 , counta + countb , "from each a:" + counta + " b:" + countb + " i:" + i );
assert.eq( j * 100 , coll.find().limit(100000000).itcount() , "itcount A" );
-assert( s.config.shard.find().toArray().map( function(z){ return z.server; } ).unique().length == 2 , "should be using both servers" );
+assert( Array.unique( s.config.shard.find().toArray().map( function(z){ return z.server; } ) ).length == 2 , "should be using both servers" );
s.stop();
diff --git a/jstests/sharding/key_string.js b/jstests/sharding/key_string.js
index c98c4dfecbc..a432e6c3379 100644
--- a/jstests/sharding/key_string.js
+++ b/jstests/sharding/key_string.js
@@ -26,7 +26,7 @@ s.adminCommand( { split : "test.foo" , find : { name : "joe" } } );
s.adminCommand( { moveshard : "test.foo" , find : { name : "joe" } , to : seconday.getMongo().name } );
-print( s.config.shard.find().toArray().tojson( "\n" ) );
+s.printShards();
assert.eq( 3 , primary.foo.find().toArray().length , "primary count" );
assert.eq( 3 , seconday.foo.find().toArray().length , "secondary count" );
diff --git a/jstests/sharding/shard2.js b/jstests/sharding/shard2.js
index af57389b623..de23cf69e79 100644
--- a/jstests/sharding/shard2.js
+++ b/jstests/sharding/shard2.js
@@ -50,7 +50,7 @@ s.adminCommand( { moveshard : "test.foo" , find : { num : 1 } , to : seconday.ge
assert.eq( 2 , seconday.foo.find().length() , "seconday should have 2 after move shard" );
assert.eq( 1 , primary.foo.find().length() , "primary should only have 1 after move shard" );
-assert.eq( 2 , s.config.shard.count() , "still should have 2 shards after move not:" + s.config.shard.find().toArray().tojson( true ) );
+assert.eq( 2 , s.config.shard.count() , "still should have 2 shards after move not:" + s.getShardString() );
shards = s.config.shard.find().toArray();
assert.neq( shards[0].server , shards[1].server , "servers should NOT be the same after the move" );
diff --git a/jstests/sharding/shard4.js b/jstests/sharding/shard4.js
index 4e7aab711cc..9bbf7763c70 100644
--- a/jstests/sharding/shard4.js
+++ b/jstests/sharding/shard4.js
@@ -31,7 +31,7 @@ assert.eq( 7 , s2.getDB( "test" ).foo.find().toArray().length , "other B" );
s.adminCommand( { split : "test.foo" , middle : { num : 2 } } );
//s.adminCommand( { moveshard : "test.foo" , find : { num : 3 } , to : s.getOther( s.getServer( "test" ) ).name } );
-print( s.config.shard.find().toArray().tojson( "\n" ) );
+s.printShards();
print( "* A" );
diff --git a/jstests/sharding/shard5.js b/jstests/sharding/shard5.js
index e8ed4925328..afc3caf9b55 100644
--- a/jstests/sharding/shard5.js
+++ b/jstests/sharding/shard5.js
@@ -33,7 +33,7 @@ assert.eq( 7 , s2.getDB( "test" ).foo.find().toArray().length , "other B" );
s.adminCommand( { split : "test.foo" , middle : { num : 2 } } );
//s.adminCommand( { moveshard : "test.foo" , find : { num : 3 } , to : s.getOther( s.getServer( "test" ) ).name } );
-print( s.config.shard.find().toArray().tojson( "\n" ) );
+s.printShards()
print( "* A" );
diff --git a/jstests/sharding/splitpick.js b/jstests/sharding/splitpick.js
index a9bcd90d355..2b0b1a49e9f 100644
--- a/jstests/sharding/splitpick.js
+++ b/jstests/sharding/splitpick.js
@@ -26,7 +26,7 @@ assert.eq( s.admin.runCommand( { splitvalue : "test.foo" , find : { a : 3 } } ).
s.adminCommand( { split : "test.foo" , find : { a : 99 } } );
assert.eq( s.config.shard.count() , 3 );
-print( s.config.shard.find().toArray().tojson( "\n" ) );
+s.printShards();
assert.eq( s.admin.runCommand( { splitvalue : "test.foo" , find : { a : 50 } } ).middle.a , 10 , "splitvalue 4 " );
diff --git a/shell/servers.js b/shell/servers.js
index 597f26261c1..a038a7dcab5 100644
--- a/shell/servers.js
+++ b/shell/servers.js
@@ -187,6 +187,14 @@ ShardingTest.prototype.adminCommand = function(cmd){
throw "command " + tojson( cmd ) + " failed: " + tojson( res );
}
+ShardingTest.prototype.getShardString = function(){
+ return Array.tojson( this.config.shard.find().toArray() , "\n" );
+}
+
+ShardingTest.prototype.printShards = function(){
+ print( this.getShardString() );
+}
+
MongodRunner = function( port, dbpath, peer, arbiter, extraArgs ) {
this.port_ = port;
this.dbpath_ = dbpath;