summaryrefslogtreecommitdiff
path: root/jstests/replsets/downstream.js
blob: f50716f03400d98162ca8dabda858152d54e7744 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// BUG: [SERVER-1768] replica set getlasterror {w: 2} after 2000 
// inserts hangs while secondary servers log "replSet error RS102 too stale to catch up" every once in a while

function newReplicaSet (name, numServers) {
    var rs = new ReplSetTest({name: name, nodes: numServers})
    rs.startSet()
    rs.initiate()
    rs.awaitReplication()
    return rs
}

function go() {
var N = 2000

// ~1KB string
var Text = ''
for (var i = 0; i < 40; i++)
    Text += 'abcdefghijklmnopqrstuvwxyz'

// Create replica set of 3 servers
var repset = newReplicaSet('repset', 3)
var conn = repset.getMaster()
var db = conn.getDB('test')

// Add data to it
var bulk = db.foo.initializeUnorderedBulkOp();
for (var i = 0; i < N; i++) {
    bulk.insert({ x: i, text: Text });
}
// wait to be copied to at least one secondary (BUG hangs here)
assert.writeOK(bulk.execute({ w: 2 }));


print('getlasterror_w2.js SUCCESS')
}

// turn off until fixed 
//go();