diff options
Diffstat (limited to 'jstests/sharding/migrateMemory.js')
| -rw-r--r-- | jstests/sharding/migrateMemory.js | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/jstests/sharding/migrateMemory.js b/jstests/sharding/migrateMemory.js index d3212200f83..5791ddabff5 100644 --- a/jstests/sharding/migrateMemory.js +++ b/jstests/sharding/migrateMemory.js @@ -40,12 +40,40 @@ printjson( stats ) ss = [] +// Stop balancer for manual move +s.stopBalancer() + for ( var f = 0; f<num; f += ( 2 * num / t.stats().nchunks ) ){ ss.push( s.getServer( "test" ).getDB( "admin" ).serverStatus() ) print( f ) - s.adminCommand( { movechunk : "test.foo" , find : { _id : f } , to : to } ) + + // + // Since we're moving chunks fast here, there's no guarantee that the to-shard will be done + // before the from-shard with the migration. + // + + while( true ){ + + try { + s.adminCommand( { movechunk : "test.foo" , find : { _id : f } , to : to } ) + } + catch( e ){ + + // Not sure if thrown as string or obj + if( tojson( e ).indexOf( "TO-shard" ) >= 0 ) continue + + printjson( e ) + throw e + } + + break; + } + } +// Re-enable balancer +s.setBalancer( true ) + for ( i=0; i<ss.length; i++ ) printjson( ss[i].mem ); |
