diff options
Diffstat (limited to 'jstests/noPassthroughWithMongod/index_hammer1.js')
-rw-r--r-- | jstests/noPassthroughWithMongod/index_hammer1.js | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/jstests/noPassthroughWithMongod/index_hammer1.js b/jstests/noPassthroughWithMongod/index_hammer1.js index 4617eb3fd98..5d89223093e 100644 --- a/jstests/noPassthroughWithMongod/index_hammer1.js +++ b/jstests/noPassthroughWithMongod/index_hammer1.js @@ -3,22 +3,37 @@ t = db.index_hammer1; t.drop(); var bulk = t.initializeUnorderedBulkOp(); -for ( i=0; i<10000; i++ ) - bulk.insert({ x: i, y: i }); +for (i = 0; i < 10000; i++) + bulk.insert({x: i, y: i}); assert.writeOK(bulk.execute()); ops = []; -for ( i=0; i<50; i++ ) - ops.push( { op : "find" , ns : t.getFullName() , query : { x : { $gt : 5000 } , y : { $gt : 5000 } } } ); - -ops[10] = { op : "createIndex" , ns : t.getFullName() , key : { x : 1 } }; -ops[20] = { op : "createIndex" , ns : t.getFullName() , key : { y : 1 } }; -ops[30] = { op : "dropIndex" , ns : t.getFullName() , key : { x : 1 } }; -ops[40] = { op : "dropIndex" , ns : t.getFullName() , key : { y : 1 } }; - -res = benchRun( { ops : ops , parallel : 5 , seconds : 20 , host : db.getMongo().host } ); -printjson( res ); - -assert.eq( 10000 , t.count() ); - +for (i = 0; i < 50; i++) + ops.push({op: "find", ns: t.getFullName(), query: {x: {$gt: 5000}, y: {$gt: 5000}}}); + +ops[10] = { + op: "createIndex", + ns: t.getFullName(), + key: {x: 1} +}; +ops[20] = { + op: "createIndex", + ns: t.getFullName(), + key: {y: 1} +}; +ops[30] = { + op: "dropIndex", + ns: t.getFullName(), + key: {x: 1} +}; +ops[40] = { + op: "dropIndex", + ns: t.getFullName(), + key: {y: 1} +}; + +res = benchRun({ops: ops, parallel: 5, seconds: 20, host: db.getMongo().host}); +printjson(res); + +assert.eq(10000, t.count()); |