0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 01:21:03 +01:00

SERVER-41859 logical_time_metadata.js shouldn't assume lastApplied opTime equals $clusterTime

This commit is contained in:
Jack Mulrow 2019-07-01 11:33:28 -04:00
parent ca904a1e30
commit 624ffeeb25

View File

@ -30,12 +30,16 @@
res = st.rs0.getPrimary().adminCommand({replSetGetStatus: 1});
// Cluster time may advance after replSetGetStatus finishes executing and before its logical
// time metadata is computed, in which case the response's $clusterTime will be greater than the
// appliedOpTime timestamp in its body. Assert the timestamp is <= $clusterTime to account for
// this.
var appliedTime = res.optimes.appliedOpTime.ts;
var logicalTimeMetadata = res.$clusterTime;
assert.eq(0,
timestampCmp(appliedTime, logicalTimeMetadata.clusterTime),
'appliedTime: ' + tojson(appliedTime) + ' != clusterTime: ' +
tojson(logicalTimeMetadata.clusterTime));
assert.lte(0,
timestampCmp(appliedTime, logicalTimeMetadata.clusterTime),
'appliedTime: ' + tojson(appliedTime) + ' not less than or equal to clusterTime: ' +
tojson(logicalTimeMetadata.clusterTime));
assert.commandWorked(db.runCommand({ping: 1, '$clusterTime': logicalTimeMetadata}));