diff options
author | Jack Mulrow <jack.mulrow@mongodb.com> | 2019-07-01 11:33:28 -0400 |
---|---|---|
committer | Jack Mulrow <jack.mulrow@mongodb.com> | 2019-07-11 12:04:54 -0400 |
commit | b144043147a069692aa5e0953c80d86cfc7e2511 (patch) | |
tree | 737a04d93ebf63dac93cc6c8e526254932781a4f | |
parent | 7ca9e9c3fa1d2220542d88b6d4e97ea12c55832f (diff) | |
download | mongo-b144043147a069692aa5e0953c80d86cfc7e2511.tar.gz |
SERVER-41859 logical_time_metadata.js shouldn't assume lastApplied opTime equals $clusterTime
(cherry picked from commit 624ffeeb25a8982f32295053d30ae1fe000cc15b)
-rw-r--r-- | jstests/sharding/logical_time_metadata.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/jstests/sharding/logical_time_metadata.js b/jstests/sharding/logical_time_metadata.js index 77932d5115e..795fe027a45 100644 --- a/jstests/sharding/logical_time_metadata.js +++ b/jstests/sharding/logical_time_metadata.js @@ -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})); |