summaryrefslogtreecommitdiff
path: root/jstests/replsets/rslib.js
diff options
context:
space:
mode:
authorMisha Tyulenev <misha@mongodb.com>2017-09-27 23:23:24 -0400
committerMisha Tyulenev <misha@mongodb.com>2017-09-27 23:23:46 -0400
commiteeee1e2b64f70e8487f017ba579f3ca861c81e4f (patch)
treee1452828e142748f1f03be61a00c32dbb3ed6bc1 /jstests/replsets/rslib.js
parent55637833c707998f685f997d43624c52cde99b45 (diff)
downloadmongo-eeee1e2b64f70e8487f017ba579f3ca861c81e4f.tar.gz
SERVER-30977 add clusterTime to standalone replica set
Diffstat (limited to 'jstests/replsets/rslib.js')
-rw-r--r--jstests/replsets/rslib.js16
1 files changed, 6 insertions, 10 deletions
diff --git a/jstests/replsets/rslib.js b/jstests/replsets/rslib.js
index 320906321c8..56e97ff2fa1 100644
--- a/jstests/replsets/rslib.js
+++ b/jstests/replsets/rslib.js
@@ -197,20 +197,16 @@ var getLastOpTime;
return master;
};
- awaitOpTime = function(node, opTime) {
- var ts, ex;
+ awaitOpTime = function(catchingUpNode, latestOpTimeNode) {
+ var ts, ex, opTime;
assert.soon(
function() {
try {
// The following statement extracts the timestamp field from the most recent
// element of
// the oplog, and stores it in "ts".
- ts = node.getDB("local")['oplog.rs']
- .find({})
- .sort({'$natural': -1})
- .limit(1)
- .next()
- .ts;
+ ts = getLatestOp(catchingUpNode).ts;
+ opTime = getLatestOp(latestOpTimeNode).ts;
if ((ts.t == opTime.t) && (ts.i == opTime.i)) {
return true;
}
@@ -221,8 +217,8 @@ var getLastOpTime;
}
},
function() {
- var message = "Node " + node + " only reached optime " + tojson(ts) + " not " +
- tojson(opTime);
+ var message = "Node " + catchingUpNode + " only reached optime " + tojson(ts) +
+ " not " + tojson(opTime);
if (ex) {
message += "; last attempt failed with exception " + tojson(ex);
}