diff options
author | Tess Avitabile <tess.avitabile@mongodb.com> | 2019-05-30 13:14:58 -0400 |
---|---|---|
committer | Tess Avitabile <tess.avitabile@mongodb.com> | 2019-05-30 17:51:20 -0400 |
commit | cdc6351dd35447dfb80f96dacfba43705462a062 (patch) | |
tree | c6ffc2e80faffb20d86be5d1d96dd4bce5d1f11e /jstests | |
parent | a5c5680c5b446d183ac874ddd096dd602a738094 (diff) | |
download | mongo-cdc6351dd35447dfb80f96dacfba43705462a062.tar.gz |
SERVER-41342 read_committed_stale_history.js must perform continuous writes to ensure majority commit point propagates to secondary
(cherry picked from commit 69fcaf0c9fa15580959dc56b7bb764b5a301685d)
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/replsets/read_committed_stale_history.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/jstests/replsets/read_committed_stale_history.js b/jstests/replsets/read_committed_stale_history.js index 3ee22559749..a7abde15ecd 100644 --- a/jstests/replsets/read_committed_stale_history.js +++ b/jstests/replsets/read_committed_stale_history.js @@ -138,9 +138,16 @@ rst.awaitReplication(); // Ensure that the old primary got the write that the new primary did and sees it as committed. - assert.neq( - null, - nodes[0].getDB(dbName).getCollection(collName).find({a: 3}).readConcern('majority').next()); + assert.soonNoExcept(function() { + // Without a consistent stream of writes, secondary majority reads are not guaranteed to + // complete, since the commit point being stale is not sufficient to establish a sync + // source. + assert.writeOK(nodes[1].getDB(dbName).getCollection("dummy").insert({dummy: 1})); + res = nodes[0].getDB(dbName).runCommand( + {find: collName, filter: {a: 3}, readConcern: {level: "majority"}, maxTimeMS: 10000}); + assert.commandWorked(res); + return res.cursor.firstBatch.length === 1; + }, "Original primary never got the new write in its majority committed snapshot"); rst.stopSet(); }()); |