summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2017-08-29 17:18:23 -0400
committerBenety Goh <benety@mongodb.com>2017-08-31 11:27:30 -0400
commitf34414101233c207951719653d72461a58dda73d (patch)
treef6b0f64dd25331c98d269729f86a615ed1a23d56
parent8024561b6a73b5b0b56200bdfa3233219ff7fb18 (diff)
downloadmongo-f34414101233c207951719653d72461a58dda73d.tar.gz
SERVER-30908 ReplSetTest.checkOplogs() skips arbiters when inspecting the oplog
-rw-r--r--src/mongo/shell/replsettest.js8
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();