diff options
author | Eliot Horowitz <eliot@10gen.com> | 2011-11-14 01:30:39 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2011-11-14 01:31:49 -0500 |
commit | aa079a1389ff589898194671babcb8307d1d3085 (patch) | |
tree | 2326eca675d044f7daf5bf35cfe75f312c86dce3 /jstests/sharding/multi_coll_drop.js | |
parent | cf87929abb72fdfc157120da542933911665974b (diff) | |
download | mongo-aa079a1389ff589898194671babcb8307d1d3085.tar.gz |
fix case where a sharded collection is dropped and we need to reset state SERVER-4262
Diffstat (limited to 'jstests/sharding/multi_coll_drop.js')
-rw-r--r-- | jstests/sharding/multi_coll_drop.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/jstests/sharding/multi_coll_drop.js b/jstests/sharding/multi_coll_drop.js new file mode 100644 index 00000000000..fc285f6a969 --- /dev/null +++ b/jstests/sharding/multi_coll_drop.js @@ -0,0 +1,45 @@ +// Tests the dropping and re-adding of a collection + +var st = new ShardingTest( name = "multidrop", shards = 1, verbose = 0, mongos = 2 ) + +var mA = st.s0 +var mB = st.s1 + +var coll = mA.getCollection( name + ".coll" ) +var collB = mB.getCollection( coll + "" ) + +jsTestLog( "Shard and split collection..." ) + +var admin = mA.getDB( "admin" ) +admin.runCommand({ enableSharding : coll.getDB() + "" }) +admin.runCommand({ shardCollection : coll + "", key : { _id : 1 } }) + +for( var i = -100; i < 100; i++ ){ + admin.runCommand({ split : coll + "", middle : { _id : i } }) +} + +jsTestLog( "Create versioned connection for each mongos..." ) + +coll.find().itcount() +collB.find().itcount() + +jsTestLog( "Dropping sharded collection..." ) +coll.drop() + +jsTestLog( "Recreating collection..." ) + +admin.runCommand({ shardCollection : coll + "", key : { _id : 1 } }) +for( var i = -10; i < 10; i++ ){ + admin.runCommand({ split : coll + "", middle : { _id : i } }) +} + +jsTestLog( "Retrying connections..." ) + +coll.find().itcount() +collB.find().itcount() + +jsTestLog( "Done." ) + +st.stop() + + |