diff options
-rw-r--r-- | src/mongo/shell/replsettest.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mongo/shell/replsettest.js b/src/mongo/shell/replsettest.js index 139a8639dc7..55d1e5bd3f0 100644 --- a/src/mongo/shell/replsettest.js +++ b/src/mongo/shell/replsettest.js @@ -1477,6 +1477,12 @@ var ReplSetTest = function(opts) { var rsSize = nodes.length; var firstReaderIndex; for (var i = 0; i < rsSize; i++) { + // Arbiters have no documents in the oplog. + const isArbiter = nodes[i].getDB('admin').isMaster('admin').arbiterOnly; + if (isArbiter) { + continue; + } + readers[i] = new OplogReader(nodes[i]); var currTS = readers[i].getFirstDoc().ts; // Find the reader which has the smallestTS. This reader should have the most @@ -1499,7 +1505,7 @@ var ReplSetTest = function(opts) { for (i = 0; i < rsSize; i++) { // Skip reading from this reader if the index is the same as firstReader or // the cursor is exhausted. - if (i === firstReaderIndex || !readers[i].hasNext()) { + if (i === firstReaderIndex || !(readers[i] && readers[i].hasNext())) { continue; } var otherOplogEntry = readers[i].next(); |