diff options
author | Lingzhi Deng <lingzhi.deng@mongodb.com> | 2020-04-08 10:22:57 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-04-23 19:49:43 +0000 |
commit | ef971dc0d15f1829081245fdb9986ea6040d1d81 (patch) | |
tree | 4cc8b650dafe188470efe81712b1acf11ea9f21b | |
parent | 2124aa0b6673f4316a99af28c2eacc8c3d8b1441 (diff) | |
download | mongo-ef971dc0d15f1829081245fdb9986ea6040d1d81.tar.gz |
SERVER-47071: Fix CheckReplOplogs hook
(cherry picked from commit 1700c42daa8b88c17ca49814b7752b9a1b14d3db)
(cherry picked from commit 560ee7f0ac9407c37989d2b00cabbc27e183edbc)
-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; |