diff options
author | Daniel Gottlieb <daniel.gottlieb@mongodb.com> | 2019-02-20 10:34:42 -0500 |
---|---|---|
committer | Daniel Gottlieb <daniel.gottlieb@mongodb.com> | 2019-02-21 08:30:39 -0500 |
commit | 1d6995441c39e5761f923dc7f9be01dd354ec3af (patch) | |
tree | d523ce792c459fa4a75f272e0f8b5ca91b81c840 /jstests/replsets/oplog_visibility.js | |
parent | 8120e440ab45ab4bd8b1372aee23cae7fad6b01e (diff) | |
download | mongo-1d6995441c39e5761f923dc7f9be01dd354ec3af.tar.gz |
SERVER-39685: Have oplog_visibility.js cope with server behaviors.
Diffstat (limited to 'jstests/replsets/oplog_visibility.js')
-rw-r--r-- | jstests/replsets/oplog_visibility.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/jstests/replsets/oplog_visibility.js b/jstests/replsets/oplog_visibility.js index 7ab7877adfc..ccdcf5c6d93 100644 --- a/jstests/replsets/oplog_visibility.js +++ b/jstests/replsets/oplog_visibility.js @@ -32,10 +32,16 @@ let writer = new ScopedThread(function(host, coll, stopLatch) { const conn = new Mongo(host); let id = 0; - while (stopLatch.getCount() > 0) { + + // Cap the amount of data being inserted to avoid rolling over a 10MiB oplog. It takes + // ~70,000 "basic" ~150 byte oplog documents to fill a 10MiB oplog. Note this number is + // for each of two writer threads. + const maxDocsToInsert = 20 * 1000; + while (stopLatch.getCount() > 0 && id < maxDocsToInsert) { conn.getDB("test").getCollection(coll).insert({_id: id}); id++; } + jsTestLog({"NumDocsWritten": id}); }, replTest.getPrimary().host, coll, stopLatch); writer.start(); @@ -68,7 +74,9 @@ // for establishing their oplog reader transactions. for (let num = 0; num < 200 && timestamps.length < 1000; ++num) { try { - cursor.hasNext(); + if (cursor.hasNext() == false) { + break; + } } catch (exc) { break; } |