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

« back to all changes in this revision

Viewing changes to jstests/replsets/maintenance.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
1
 
2
2
 
3
3
var replTest = new ReplSetTest( {name: 'unicomplex', nodes: 2} );
4
 
var conns = replTest.startSet();
 
4
var conns = replTest.startSet({ verbose: 1 });
5
5
replTest.initiate();
6
6
 
7
7
// Make sure we have a master
8
8
var master = replTest.getMaster();
9
9
 
10
 
for (i=0;i<10000; i++) { master.getDB("bar").foo.insert({x:1,y:i,abc:123,str:"foo bar baz"}); }
11
 
for (i=0;i<1000; i++) { master.getDB("bar").foo.update({y:i},{$push :{foo : "barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr"}}); }
 
10
for (i = 0; i < 20; i++) {
 
11
    master.getDB("bar").foo.insert({x:1,y:i,abc:123,str:"foo bar baz"});
 
12
}
 
13
for (i = 0; i < 20; i++) {
 
14
    master.getDB("bar").foo.update({ y: i }, { $push: { foo: "barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr"}});
 
15
}
12
16
 
13
17
replTest.awaitReplication();
14
18
 
46
50
assert.eq(result.ok, 0, tojson(result));
47
51
 
48
52
print("check getMore works on a secondary, not on a recovering node");
49
 
var cursor = conns[1].getDB("bar").foo.find();
50
 
for (var i=0; i<50; i++) {
 
53
var cursor = conns[1].getDB("bar").foo.find().batchSize(2);
 
54
for (var i = 0; i < 5; i++) {
51
55
    cursor.next();
52
56
}
53
57
 
64
68
});
65
69
 
66
70
print("now getmore shouldn't work");
67
 
lastDoc = null;
68
 
while (cursor.hasNext()) {
69
 
    lastDoc = cursor.next();
70
 
}
 
71
var ex = assert.throws(
 
72
        function(){
 
73
                lastDoc = null;
 
74
                while (cursor.hasNext()) {
 
75
                        lastDoc = cursor.next();
 
76
                }
 
77
        },
 
78
        [] /*no params*/,
 
79
        "getmore didn't fail")
71
80
 
72
 
print("the shell is currently stupid and won't throw once it's returned any query results");
73
 
printjson(lastDoc);
74
 
assert("$err" in lastDoc);
75
 
assert.eq(lastDoc.code, 13436);
 
81
assert(ex.match("13436"), "wrong error code -- " + ex );
76
82
 
77
83
result = conns[1].getDB("admin").runCommand({replSetMaintenance : 0});
78
84
assert.eq(result.ok, 1, tojson(result));