diff options
author | Eric Milkie <milkie@10gen.com> | 2016-12-13 11:54:19 -0500 |
---|---|---|
committer | Eric Milkie <milkie@10gen.com> | 2016-12-13 14:19:53 -0500 |
commit | 517f07c6c5f91fdb3590109570661001c0c12d20 (patch) | |
tree | ec2156797d50b1b38bc20d6cbbff970385750348 /jstests/replsets/read_after_optime.js | |
parent | 68908f8e03ee1a4c0400dae26cc20b0c304b913b (diff) | |
download | mongo-517f07c6c5f91fdb3590109570661001c0c12d20.tar.gz |
SERVER-27405 fix race in read_after_optime.js
Diffstat (limited to 'jstests/replsets/read_after_optime.js')
-rw-r--r-- | jstests/replsets/read_after_optime.js | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/jstests/replsets/read_after_optime.js b/jstests/replsets/read_after_optime.js index bb0e041c05f..e7e911c5722 100644 --- a/jstests/replsets/read_after_optime.js +++ b/jstests/replsets/read_after_optime.js @@ -78,34 +78,31 @@ // Test read on future afterOpTime that will eventually occur. primaryConn.getDB(dbName).parallelShellStarted.drop(); - var insertFunc = - startParallelShell('let testDB = db.getSiblingDB("' + dbName + '"); ' + - 'testDB.parallelShellStarted.insert({}); ' + - 'sleep(2100); ' + - 'testDB.user.insert({y: 1}, { writeConcern: { w: 2 }});', - primaryConn.port); - assert.soon(function() { - return primaryConn.getDB(dbName).parallelShellStarted.count(); - }); - oplogTS = localDB.oplog.rs.find().sort({$natural: -1}).limit(1).next(); + var insertFunc = startParallelShell('let testDB = db.getSiblingDB("' + dbName + '"); ' + + 'sleep(3000); ' + + 'testDB.user.insert({y: 1});', + primaryConn.port); + var twoSecTS = new Timestamp(oplogTS.ts.getTime() + 2, 0); var res = assert.commandWorked(testDB.runCommand({ find: 'user', - filter: {x: 1}, + filter: {y: 1}, readConcern: { afterOpTime: {ts: twoSecTS, t: term}, }, - maxTimeMS: 10 * 1000, + maxTimeMS: 90 * 1000, })); assert.eq(null, res.code); - + assert.eq(res.cursor.firstBatch[0].y, 1); insertFunc(); }; var primary = replTest.getPrimary(); + jsTest.log("test1"); runTest(primary.getDB('test1'), primary); + jsTest.log("test2"); runTest(replTest.getSecondary().getDB('test2'), primary); replTest.stopSet(); |