diff options
author | Mathias Stearn <mathias@10gen.com> | 2014-03-27 16:15:09 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2014-03-27 17:47:08 -0400 |
commit | d061fb5f993aff589538c9add71af4765be1b65d (patch) | |
tree | 4c0c48f3f31f0493ebbd9a3bb05e6117a44e58ba /jstests/noPassthroughWithMongod/memory.js | |
parent | 4201130bb08808b3d1ac6441b97fd2b6820a62a2 (diff) | |
download | mongo-d061fb5f993aff589538c9add71af4765be1b65d.tar.gz |
SERVER-13391 Rename slowNightly -> noPassthroughWithMongod and slowWeekly -> noPassthrough
This better represents their purpose and the difference between them.
(cherry picked from commit d0a1e84ab2fa1b6aa699721b5cb9a4f8d0bf3692)
Diffstat (limited to 'jstests/noPassthroughWithMongod/memory.js')
-rw-r--r-- | jstests/noPassthroughWithMongod/memory.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/jstests/noPassthroughWithMongod/memory.js b/jstests/noPassthroughWithMongod/memory.js new file mode 100644 index 00000000000..48265e77b31 --- /dev/null +++ b/jstests/noPassthroughWithMongod/memory.js @@ -0,0 +1,42 @@ +var col = db.memoryTest; + +// test creating many collections to make sure no internal cache goes OOM +for (var i = 0; i < 10000; ++i) { + name = "memoryTest" + i; + if ((i % 1000) == 0) print("Processing " + name); + db.eval(function(col) { for (var i = 0; i < 100; ++i) {db[col + "_" + i].find();} }, name); +} + +// test recovery of JS engine after out of memory +db.system.js.save( { "_id" : "f1", "value" : function(n) { + a = []; + b = []; + c = []; + for (i = 0; i < n; i++) { + a.push(Math.random()); + b.push(Math.random()); + c.push(Math.random()); + } +} }) + +// do mix of calls to make sure OOM is handled with no permanent damage +db.eval("f1(10)"); +assert.throws(function() { db.eval("f1(100000000)"); } ); +db.eval("f1(10)"); +assert.throws(function() { db.eval("f1(1000000000)"); } ); +db.eval("f1(1000000)"); +db.eval("f1(1000000)"); +db.eval("f1(1000000)"); +assert.throws(function() { db.eval("f1(100000000)"); } ); +db.eval("f1(10)"); +db.eval("f1(1000000)"); +db.eval("f1(1000000)"); +db.eval("f1(1000000)"); + +// also test $where +col.drop(); +col.insert({a: 1}); +col.findOne({$where: "var arr = []; for (var i = 0; i < 1000000; ++i) {arr.push(0);}"}); +assert.throws(function() { col.findOne({$where: "var arr = []; for (var i = 0; i < 1000000000; ++i) {arr.push(0);}"}); }); +col.findOne({$where: "var arr = []; for (var i = 0; i < 1000000; ++i) {arr.push(0);}"}); + |