~evarlast/ubuntu/utopic/mongodb/upstart-workaround-debian-bug-718702

« back to all changes in this revision

Viewing changes to jstests/replsets/stale_clustered.js

  • Committer: Package Import Robot
  • Author(s): James Page, James Page, Robie Basak
  • Date: 2013-05-29 17:44:42 UTC
  • mfrom: (44.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20130529174442-z0a4qmoww4y0t458
Tags: 1:2.4.3-1ubuntu1
[ James Page ]
* Merge from Debian unstable, remaining changes:
  - Enable SSL support:
    + d/control: Add libssl-dev to BD's.
    + d/rules: Enabled --ssl option.
    + d/mongodb.conf: Add example SSL configuration options.
  - d/mongodb-server.mongodb.upstart: Add upstart configuration.
  - d/rules: Don't strip binaries during scons build for Ubuntu.
  - d/control: Add armhf to target archs.
  - d/p/SConscript.client.patch: fixup install of client libraries.
  - d/p/0010-install-libs-to-usr-lib-not-usr-lib64-Closes-588557.patch:
    Install libraries to lib not lib64.
* Dropped changes:
  - d/p/arm-support.patch: Included in Debian.
  - d/p/double-alignment.patch: Included in Debian.
  - d/rules,control: Debian also builds with avaliable system libraries
    now.
* Fix FTBFS due to gcc and boost upgrades in saucy:
  - d/p/0008-ignore-unused-local-typedefs.patch: Add -Wno-unused-typedefs
    to unbreak building with g++-4.8.
  - d/p/0009-boost-1.53.patch: Fixup signed/unsigned casting issue.

[ Robie Basak ]
* d/p/0011-Use-a-signed-char-to-store-BSONType-enumerations.patch: Fixup
  build failure on ARM due to missing signed'ness of char cast.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// this tests that slaveOk'd queries in sharded setups get correctly routed when
2
 
// a slave goes into RECOVERING state, and don't break
3
 
 
4
 
function prt(s) {
5
 
    print("\nstale_clustered.js " + s);
6
 
    print();
7
 
}
8
 
 
9
 
var shardTest = new ShardingTest( name = "clusteredstale" ,
10
 
                                  numShards = 2 ,
11
 
                                  verboseLevel = 0 ,
12
 
                                  numMongos = 2 ,
13
 
                                  otherParams = { rs : true } )//, 
14
 
                                                  //rs0 : { logpath : "$path/mongod.log" }, 
15
 
                                                  //rs1 : { logpath : "$path/mongod.log" } } );
16
 
 
17
 
shardTest.setBalancer( false )
18
 
 
19
 
var mongos = shardTest.s0
20
 
var mongosSOK = shardTest.s1
21
 
mongosSOK.setSlaveOk()
22
 
 
23
 
var admin = mongos.getDB("admin")
24
 
var config = mongos.getDB("config")
25
 
 
26
 
var dbase = mongos.getDB("test")
27
 
var coll = dbase.getCollection("foo")
28
 
var dbaseSOk = mongosSOK.getDB( "" + dbase )
29
 
var collSOk = mongosSOK.getCollection( "" + coll )
30
 
 
31
 
 
32
 
var rsA = shardTest._rs[0].test
33
 
var rsB = shardTest._rs[1].test
34
 
 
35
 
rsA.getMaster().getDB( "test_a" ).dummy.insert( { x : 1 } )
36
 
rsB.getMaster().getDB( "test_b" ).dummy.insert( { x : 1 } )
37
 
 
38
 
rsA.awaitReplication()
39
 
rsB.awaitReplication()
40
 
 
41
 
prt("1: initial insert")
42
 
 
43
 
coll.save({ _id : -1, a : "a", date : new Date() })
44
 
coll.save({ _id : 1, b : "b", date : new Date() })
45
 
 
46
 
prt("2: shard collection")
47
 
 
48
 
shardTest.shardGo( coll, /* shardBy */ { _id : 1 }, /* splitAt */ { _id : 0 } )
49
 
 
50
 
prt("3: test normal and slaveOk queries")
51
 
 
52
 
// Make shardA and rsA the same
53
 
var shardA = shardTest.getShard(  coll, { _id : -1 } )
54
 
var shardAColl = shardA.getCollection( "" + coll )
55
 
var shardB = shardTest.getShard(  coll, { _id : 1 } )
56
 
 
57
 
if( shardA.name == rsB.getURL() ){
58
 
    var swap = rsB
59
 
    rsB = rsA
60
 
    rsA = swap
61
 
}
62
 
 
63
 
rsA.awaitReplication()
64
 
rsB.awaitReplication()
65
 
 
66
 
assert.eq( coll.find().itcount(), collSOk.find().itcount() )
67
 
assert.eq( shardAColl.find().itcount(), 1 )
68
 
assert.eq( shardAColl.findOne()._id, -1 )
69
 
 
70
 
prt("5: overflow oplog");
71
 
 
72
 
var secs = rsA.getSecondaries()
73
 
var goodSec = secs[0]
74
 
var badSec = secs[1]
75
 
 
76
 
rsA.overflow( badSec )
77
 
 
78
 
prt("6: stop non-overflowed secondary")
79
 
 
80
 
rsA.stop( goodSec, undefined, true )
81
 
 
82
 
prt("7: check our regular and slaveOk query")
83
 
 
84
 
assert.eq( coll.find().itcount(), collSOk.find().itcount() )
85
 
 
86
 
prt("8: restart both our secondaries clean")
87
 
 
88
 
rsA.restart( rsA.getSecondaries(), { remember : true, startClean : true }, undefined, 5 * 60 * 1000 )
89
 
 
90
 
prt("9: wait for recovery")
91
 
 
92
 
rsA.waitForState( rsA.getSecondaries(), rsA.SECONDARY, 5 * 60 * 1000 )
93
 
 
94
 
prt("10: check our regular and slaveOk query")
95
 
 
96
 
assert.eq( coll.find().itcount(), collSOk.find().itcount() )
97
 
 
98
 
prt("DONE\n\n\n");
99
 
 
100
 
//shardTest.stop()
101