3
s = new ShardingTest( "multcollections" , 2 , 1 , 1 , { chunksize : 1 } );
5
s.adminCommand( { enablesharding : "test" } );
12
while ( S.length < 500 )
15
for ( i=0; i<N; i++ ){
16
db.foo.insert( { _id : i , s : S } )
17
db.bar.insert( { _id : i , s : S , s2 : S } )
21
db.printShardingStatus()
23
function mytest( coll , i , loopNumber ){
24
x = coll.find( { _id : i } ).explain();
27
throw "can't find " + i + " in " + coll.getName() + " on loopNumber: " + loopNumber + " explain: " + tojson( x );
32
for ( i=0; i<N; i++ ){
33
mytest( db.foo , i , loopNumber );
34
mytest( db.bar , i , loopNumber );
38
db.printShardingStatus()
41
if ( loopNumber == 1 ){
42
s.adminCommand( { shardcollection : "test.foo" , key : { _id : 1 } } );
43
s.adminCommand( { shardcollection : "test.bar" , key : { _id : 1 } } );
46
assert( loopNumber < 1000 , "taking too long" );
48
if ( s.chunkDiff( "foo" ) < 12 && s.chunkDiff( "bar" ) < 12 )