diff options
Diffstat (limited to 'src/mongo/shell/replsettest.js')
-rw-r--r-- | src/mongo/shell/replsettest.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/mongo/shell/replsettest.js b/src/mongo/shell/replsettest.js index 05c4b584ff2..eedbec32958 100644 --- a/src/mongo/shell/replsettest.js +++ b/src/mongo/shell/replsettest.js @@ -2131,13 +2131,13 @@ var ReplSetTest = function(opts) { }; this.next = function() { - this._safelyPerformCursorOperation('next', function(cursor) { + return this._safelyPerformCursorOperation('next', function(cursor) { return cursor.next(); }, kCappedPositionLostSentinel); }; this.hasNext = function() { - this._safelyPerformCursorOperation('hasNext', function(cursor) { + return this._safelyPerformCursorOperation('hasNext', function(cursor) { return cursor.hasNext(); }, false); }; @@ -2213,6 +2213,7 @@ var ReplSetTest = function(opts) { // Note, we read the oplog backwards from last to first. const firstReader = readers[firstReaderIndex]; let prevOplogEntry; + assert(firstReader.hasNext(), "oplog is empty while checkOplogs is called"); while (firstReader.hasNext()) { const oplogEntry = firstReader.next(); if (oplogEntry === kCappedPositionLostSentinel) { @@ -2230,8 +2231,12 @@ var ReplSetTest = function(opts) { const otherOplogEntry = readers[i].next(); if (otherOplogEntry && otherOplogEntry !== kCappedPositionLostSentinel) { - assertOplogEntriesEq( - oplogEntry, otherOplogEntry, firstReader, readers[i], prevOplogEntry); + assertOplogEntriesEq.call(this, + oplogEntry, + otherOplogEntry, + firstReader, + readers[i], + prevOplogEntry); } } prevOplogEntry = oplogEntry; |