diff options
author | Antonin Kral <a.kral@bobek.cz> | 2012-05-10 06:57:54 +0200 |
---|---|---|
committer | Antonin Kral <a.kral@bobek.cz> | 2012-05-10 06:57:54 +0200 |
commit | 61619b3142c1de8f60f91964ff2656054d4f11a6 (patch) | |
tree | d3aaf9d1e70cac8efa0856e5b5ba39e2fb9dc526 /jstests/sharding | |
parent | eaaa7b30c99b89b5483e0a372bb73fe8c8695185 (diff) | |
download | mongodb-61619b3142c1de8f60f91964ff2656054d4f11a6.tar.gz |
Imported Upstream version 2.0.5
Diffstat (limited to 'jstests/sharding')
-rw-r--r-- | jstests/sharding/mongos_no_detect_sharding.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/jstests/sharding/mongos_no_detect_sharding.js b/jstests/sharding/mongos_no_detect_sharding.js new file mode 100644 index 0000000..d5e9b53 --- /dev/null +++ b/jstests/sharding/mongos_no_detect_sharding.js @@ -0,0 +1,42 @@ +// Tests whether new sharding is detected on insert by mongos + +var st = new ShardingTest( name = "test", shards = 1, verbose = 2, mongos = 2, other = { separateConfig : true } ) + +var mongos = st.s +var config = mongos.getDB("config") + +config.settings.update({ _id : "balancer" }, { $set : { stopped : true } }, true ) + + +print( "Creating unsharded connection..." ) + + +var mongos2 = st._mongos[1] + +var coll = mongos2.getCollection( "test.foo" ) +coll.insert({ i : 0 }) + +print( "Sharding collection..." ) + +var admin = mongos.getDB("admin") + +assert.eq( coll.getShardVersion().ok, 0 ) + +admin.runCommand({ enableSharding : "test" }) +admin.runCommand({ shardCollection : "test.foo", key : { _id : 1 } }) + +print( "Seeing if data gets inserted unsharded..." ) +print( "No splits occur here!" ) + +// Insert a bunch of data which should trigger a split +for( var i = 0; i < 100; i++ ){ + coll.insert({ i : i + 1 }) +} +coll.getDB().getLastError() + +config.printShardingStatus( true ) + +assert.eq( coll.getShardVersion().ok, 1 ) +assert.eq( 101, coll.find().itcount() ) + +st.stop()
\ No newline at end of file |