4
* tests picking the middle to split on
7
s = new ShardingTest( "splitpick" , 2 );
9
db = s.getDB( "test" );
11
s.adminCommand( { enablesharding : "test" } );
12
s.adminCommand( { shardcollection : "test.foo" , key : { a : 1 } } );
16
for ( var i=1; i<20; i++ ){
21
assert.eq( s.admin.runCommand( { splitvalue : "test.foo" , find : { a : 1 } } ).middle.a , 1 , "splitvalue 1" );
22
assert.eq( s.admin.runCommand( { splitvalue : "test.foo" , find : { a : 3 } } ).middle.a , 1 , "splitvalue 2" );
24
s.adminCommand( { split : "test.foo" , find : { a : 1 } } );
25
assert.eq( s.admin.runCommand( { splitvalue : "test.foo" , find : { a : 3 } } ).middle.a , 99 , "splitvalue 3" );
26
s.adminCommand( { split : "test.foo" , find : { a : 99 } } );
28
assert.eq( s.config.chunks.count() , 3 );
31
assert.eq( s.admin.runCommand( { splitvalue : "test.foo" , find : { a : 50 } } ).middle.a , 10 , "splitvalue 4 " );