diff options
author | Jack Mulrow <jack.mulrow@mongodb.com> | 2019-07-01 11:53:33 -0400 |
---|---|---|
committer | Jack Mulrow <jack.mulrow@mongodb.com> | 2019-07-11 11:58:42 -0400 |
commit | 1ed216bc95b6f6b75a3d02161312671745f8c974 (patch) | |
tree | f04f0c4f690687ebd71ad7d6f25120ac009942fe /jstests/sharding/shards_and_config_return_last_committed_optime.js | |
parent | 31efab485d7c128cbaa0f2c702fa71b8e90f8107 (diff) | |
download | mongo-1ed216bc95b6f6b75a3d02161312671745f8c974.tar.gz |
SERVER-42024 Fix opTime race in shards_and_config_return_last_committed_optime.js
(cherry picked from commit 47c4ce9e44df98b6b5c2586c73f6b25e29722414)
Diffstat (limited to 'jstests/sharding/shards_and_config_return_last_committed_optime.js')
-rw-r--r-- | jstests/sharding/shards_and_config_return_last_committed_optime.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/jstests/sharding/shards_and_config_return_last_committed_optime.js b/jstests/sharding/shards_and_config_return_last_committed_optime.js index 88d63c3affc..b884deaef39 100644 --- a/jstests/sharding/shards_and_config_return_last_committed_optime.js +++ b/jstests/sharding/shards_and_config_return_last_committed_optime.js @@ -50,12 +50,16 @@ "Expected response from a " + connType + " to contain lastCommittedOpTime," + " received: " + tojson(res) + ", cmd was: " + tojson(cmdObj)); + // The last committed opTime may advance after replSetGetStatus finishes executing and + // before its response's metadata is computed, in which case the response's + // lastCommittedOpTime will be greater than the lastCommittedOpTime timestamp in its + // body. Assert the timestamp is <= lastCommittedOpTime to account for this. const statusRes = assert.commandWorked(testDB.adminCommand({replSetGetStatus: 1})); - assert.eq( + assert.lte( 0, bsonWoCompare(res.lastCommittedOpTime, statusRes.optimes.lastCommittedOpTime.ts), "lastCommittedOpTime in command response, " + res.lastCommittedOpTime + - ", does not equal the replSetGetStatus lastCommittedOpTime timestamp, " + + ", is not <= to the replSetGetStatus lastCommittedOpTime timestamp, " + statusRes.optimes.lastCommittedOpTime.ts + ", cmd was: " + tojson(cmdObj)); return true; |