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 11:57:15 -0400 |
commit | 31efab485d7c128cbaa0f2c702fa71b8e90f8107 (patch) | |
tree | 9f677de9a193ce420d67ba8397d965e675478b27 | |
parent | 83f004393c7f5028d6c57866894820fea461f0da (diff) | |
download | mongo-31efab485d7c128cbaa0f2c702fa71b8e90f8107.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 1ba5a10ac11..e8afac2f5b3 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})); |