0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 01:21:03 +01:00

SERVER-39685: Have oplog_visibility.js cope with server behaviors.

This commit is contained in:
Daniel Gottlieb 2019-02-20 10:34:42 -05:00
parent 8120e440ab
commit 1d6995441c

View File

@ -32,10 +32,16 @@
let writer = new ScopedThread(function(host, coll, stopLatch) { let writer = new ScopedThread(function(host, coll, stopLatch) {
const conn = new Mongo(host); const conn = new Mongo(host);
let id = 0; 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}); conn.getDB("test").getCollection(coll).insert({_id: id});
id++; id++;
} }
jsTestLog({"NumDocsWritten": id});
}, replTest.getPrimary().host, coll, stopLatch); }, replTest.getPrimary().host, coll, stopLatch);
writer.start(); writer.start();
@ -68,7 +74,9 @@
// for establishing their oplog reader transactions. // for establishing their oplog reader transactions.
for (let num = 0; num < 200 && timestamps.length < 1000; ++num) { for (let num = 0; num < 200 && timestamps.length < 1000; ++num) {
try { try {
cursor.hasNext(); if (cursor.hasNext() == false) {
break;
}
} catch (exc) { } catch (exc) {
break; break;
} }