~ubuntu-branches/ubuntu/utopic/mongodb/utopic

« back to all changes in this revision

Viewing changes to jstests/slow1/memory.js

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-07-03 09:23:46 UTC
  • mfrom: (1.3.10) (44.1.14 sid)
  • Revision ID: package-import@ubuntu.com-20140703092346-c5bvt46wnzougyly
Tags: 1:2.6.3-0ubuntu1
* New upstream stable release:
  - Dropped patches, included upstream:
    + 0003-All-platforms-but-Windows-find-hash-in-std-tr1.patch
    + 0008-Use-system-libstemmer.patch
    + 0011-Use-a-signed-char-to-store-BSONType-enumerations.patch
    + 0001-SERVER-12064-Atomic-operations-for-gcc-non-Intel-arc.patch
    + 0002-SERVER-12065-Support-ARM-and-AArch64-builds.patch
  - d/p/*: Refreshed/rebased remaining patches.
  - Use system provided libyaml-cpp:
    + d/control: Add libyaml-cpp-dev to BD's.
    + d/rules: Enable --with-system-yaml option.
    + d/p/fix-yaml-detection.patch: Fix detection of libyaml-cpp library.
  - d/mongodb-server.mongodb.upstart: Sync changes from upstream.
  - d/control,mongodb-dev.*: Drop mongodb-dev package; it has no reverse
    dependencies and upstream no longer install header files.
  - d/NEWS: Point users to upstream upgrade documentation for upgrades
    from 2.4 to 2.6.
* Merge from Debian unstable.
* d/control: BD on libv8-3.14-dev to ensure that transitioning to new v8
  versions is a explicit action due to changes in behaviour in >= 3.25
  (LP: #1295723).
* d/mongodb-server.prerm: Dropped debug echo call from maintainer script
  (LP: #1294455).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
var col = db.memoryTest;
 
2
 
 
3
// test creating many collections to make sure no internal cache goes OOM
 
4
for (var i = 0; i < 10000; ++i) {
 
5
    name = "memoryTest" + i;
 
6
    if ((i % 1000) == 0) print("Processing " + name);
 
7
    db.eval(function(col) { for (var i = 0; i < 100; ++i) {db[col + "_" + i].find();} }, name);
 
8
}
 
9
 
 
10
// test recovery of JS engine after out of memory
 
11
db.system.js.save( { "_id" : "f1", "value" : function(n) {
 
12
    a = [];
 
13
    b = [];
 
14
    c = [];
 
15
    for (i = 0; i < n; i++) {
 
16
        a.push(Math.random());
 
17
        b.push(Math.random());
 
18
        c.push(Math.random());
 
19
    }
 
20
} })
 
21
 
 
22
// do mix of calls to make sure OOM is handled with no permanent damage
 
23
db.eval("f1(10)");
 
24
assert.throws(function() { db.eval("f1(100000000)"); } );
 
25
db.eval("f1(10)");
 
26
assert.throws(function() { db.eval("f1(1000000000)"); } );
 
27
db.eval("f1(1000000)");
 
28
db.eval("f1(1000000)");
 
29
db.eval("f1(1000000)");
 
30
assert.throws(function() { db.eval("f1(100000000)"); } );
 
31
db.eval("f1(10)");
 
32
db.eval("f1(1000000)");
 
33
db.eval("f1(1000000)");
 
34
db.eval("f1(1000000)");
 
35
 
 
36
// also test $where
 
37
col.drop();
 
38
col.insert({a: 1});
 
39
col.findOne({$where: "var arr = []; for (var i = 0; i < 1000000; ++i) {arr.push(0);}"});
 
40
assert.throws(function() { col.findOne({$where: "var arr = []; for (var i = 0; i < 1000000000; ++i) {arr.push(0);}"}); });
 
41
col.findOne({$where: "var arr = []; for (var i = 0; i < 1000000; ++i) {arr.push(0);}"});
 
42