diff options
Diffstat (limited to 'jstests/sharding/sharded_profile.js')
-rw-r--r-- | jstests/sharding/sharded_profile.js | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/jstests/sharding/sharded_profile.js b/jstests/sharding/sharded_profile.js index 0ae81862e0e..c38b178f73a 100644 --- a/jstests/sharding/sharded_profile.js +++ b/jstests/sharding/sharded_profile.js @@ -3,33 +3,32 @@ (function() { - var st = new ShardingTest({shards: 1, mongos: 2}); - st.stopBalancer(); +var st = new ShardingTest({shards: 1, mongos: 2}); +st.stopBalancer(); - var admin = st.s0.getDB('admin'); - var shards = st.s0.getCollection('config.shards').find().toArray(); - var coll = st.s0.getCollection('foo.bar'); +var admin = st.s0.getDB('admin'); +var shards = st.s0.getCollection('config.shards').find().toArray(); +var coll = st.s0.getCollection('foo.bar'); - assert(admin.runCommand({enableSharding: coll.getDB() + ''}).ok); - assert(admin.runCommand({shardCollection: coll + '', key: {_id: 1}}).ok); +assert(admin.runCommand({enableSharding: coll.getDB() + ''}).ok); +assert(admin.runCommand({shardCollection: coll + '', key: {_id: 1}}).ok); - st.printShardingStatus(); +st.printShardingStatus(); - jsTest.log('Turning on profiling on ' + st.shard0); +jsTest.log('Turning on profiling on ' + st.shard0); - st.shard0.getDB(coll.getDB().toString()).setProfilingLevel(2); +st.shard0.getDB(coll.getDB().toString()).setProfilingLevel(2); - var profileColl = st.shard0.getDB(coll.getDB().toString()).system.profile; +var profileColl = st.shard0.getDB(coll.getDB().toString()).system.profile; - var inserts = [{_id: 0}, {_id: 1}, {_id: 2}]; +var inserts = [{_id: 0}, {_id: 1}, {_id: 2}]; - assert.writeOK(st.s1.getCollection(coll.toString()).insert(inserts)); +assert.writeOK(st.s1.getCollection(coll.toString()).insert(inserts)); - profileEntry = profileColl.findOne(); - assert.neq(null, profileEntry); - printjson(profileEntry); - assert.eq(profileEntry.command.documents, inserts); - - st.stop(); +profileEntry = profileColl.findOne(); +assert.neq(null, profileEntry); +printjson(profileEntry); +assert.eq(profileEntry.command.documents, inserts); +st.stop(); })(); |