0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 09:06:21 +01:00

SERVER-19890 fix jstests/replsets/read_committed_no_snapshots.js to use lastOpVisible

This commit is contained in:
matt dannenberg 2015-08-14 09:17:59 -04:00
parent 4cf56d86a3
commit 2475abdf1f

View File

@ -35,12 +35,19 @@ if (!db.serverStatus().storageEngine.supportsCommittedReads) {
}
// Do a write, wait for it to replicate, and ensure it is visible.
assert.writeOK(db.foo.save({_id: 1, state: 0}, {writeConcern: {w: "majority", wtimeout: 60*1000}}));
var res = db.runCommandWithMetadata(
"insert",
{
insert: "foo",
documents: [{_id: 1, state: 0}],
writeConcern: {w: "majority", wtimeout: 60*1000}
},
{"$replData": 1});
assert.commandWorked(res.commandReply);
// We need to propagate the lastOp from the primary as afterOpTime in the secondary to ensure we
// wait for the write to be in the majority committed view.
// TODO SERVER-19890 Fix this to get the real optime rather than constructing a fake one.
var lastOp = {ts: db.getLastErrorObj().lastOp, term: 1};
// We need to propagate the lastOpVisible from the primary as afterOpTime in the secondary to ensure
// we wait for the write to be in the majority committed view.
var lastOp = res.metadata["$replData"].lastOpVisible;
secondary.setSlaveOk();
// Timeout is based on heartbeat timeout.