summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJudah Schvimer <judah@mongodb.com>2020-05-11 15:27:52 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-05-26 18:33:52 +0000
commitba908bd27c2c0aaf4a753c96f0f9cf3790a507aa (patch)
treee844239cd6f7b74a34c4a3b359185d1db4b31e76
parent545ea895bfd90ea274a2b8da34c4534d6dc9c0af (diff)
downloadmongo-ba908bd27c2c0aaf4a753c96f0f9cf3790a507aa.tar.gz
SERVER-48101 Use "j:true" when persistence is enabled in optime.js
(cherry picked from commit 8a3c23aa1139c9835223ebecc583ef0e7fca9223)
-rw-r--r--jstests/replsets/optime.js22
1 files changed, 18 insertions, 4 deletions
diff --git a/jstests/replsets/optime.js b/jstests/replsets/optime.js
index 867c6258441..8bf90f7f606 100644
--- a/jstests/replsets/optime.js
+++ b/jstests/replsets/optime.js
@@ -77,6 +77,10 @@ let initialReplStatusInfo = master.getDB('admin').runCommand({replSetGetStatus:
// Do an insert to increment optime, but without rolling the oplog
// latestOptime should be updated, but earliestOptime should be unchanged
var options = {writeConcern: {w: replTest.nodes.length}};
+if (isPersistent) {
+ // Ensure the durable optime is advanced.
+ options.writeConcern.j = true;
+}
assert.writeOK(master.getDB('test').foo.insert({a: 1}, options));
assert.soon(function() {
return optimesAndWallTimesAreEqual(replTest, isPersistent);
@@ -84,16 +88,26 @@ assert.soon(function() {
var info = master.getDB('admin').serverStatus({oplog: true}).oplog;
let replStatusInfo = master.getDB('admin').runCommand({replSetGetStatus: 1});
-assert.gt(timestampCompare(info.latestOptime, initialInfo.latestOptime), 0);
+
+const dumpInfoFn = function() {
+ jsTestLog("Initial server status: " + tojsononeline(initialInfo));
+ jsTestLog("Initial replSetGetStatus: " + tojsononeline(initialReplStatusInfo));
+ jsTestLog("Final server status: " + tojsononeline(info));
+ jsTestLog("Final replSetGetStatus: " + tojsononeline(replStatusInfo));
+};
+
+assert.gt(timestampCompare(info.latestOptime, initialInfo.latestOptime), 0, dumpInfoFn);
assert.gt(wallTimeCompare(replStatusInfo.optimes.lastAppliedWallTime,
initialReplStatusInfo.optimes.lastAppliedWallTime),
- 0);
+ 0,
+ dumpInfoFn);
if (isPersistent) {
assert.gt(wallTimeCompare(replStatusInfo.optimes.lastDurableWallTime,
initialReplStatusInfo.optimes.lastDurableWallTime),
- 0);
+ 0,
+ dumpInfoFn);
}
-assert.eq(timestampCompare(info.earliestOptime, initialInfo.earliestOptime), 0);
+assert.eq(timestampCompare(info.earliestOptime, initialInfo.earliestOptime), 0, dumpInfoFn);
// Insert some large documents to force the oplog to roll over
var largeString = new Array(1024 * 10).toString();