summaryrefslogtreecommitdiff
path: root/src/mongo/shell
diff options
context:
space:
mode:
authorMatthew Russotto <matthew.russotto@10gen.com>2018-07-03 17:23:47 -0400
committerMatthew Russotto <matthew.russotto@10gen.com>2018-07-03 17:23:47 -0400
commit7c8d941c7f6904a65476ca91c6013067d2149fe8 (patch)
treedad323ec1bb1d1de96378dd636dbaeb1a9115189 /src/mongo/shell
parent5b8b8934c0007decb3d62915b1265f2dadfc9f4b (diff)
downloadmongo-7c8d941c7f6904a65476ca91c6013067d2149fe8.tar.gz
SERVER-34414 Create system indexes using the normal index creation and replication process.
Do not create them directly on secondaries. Do create oplog entries for index creation.
Diffstat (limited to 'src/mongo/shell')
-rw-r--r--src/mongo/shell/replsettest.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mongo/shell/replsettest.js b/src/mongo/shell/replsettest.js
index 74c677671bc..94e5e8b18b3 100644
--- a/src/mongo/shell/replsettest.js
+++ b/src/mongo/shell/replsettest.js
@@ -1816,6 +1816,7 @@ var ReplSetTest = function(opts) {
// '_master' must have been populated.
var primary = rst._master;
var combinedDBs = new Set(primary.getDBNames());
+ const replSetConfig = rst.getReplSetConfigFromNode();
slaves.forEach(secondary => {
secondary.getDBNames().forEach(dbName => combinedDBs.add(dbName));
@@ -1915,8 +1916,10 @@ var ReplSetTest = function(opts) {
// Check that the following collection stats are the same across replica set
// members:
// capped
- // nindexes
+ // nindexes, except on nodes with buildIndexes: false
// ns
+ const hasSecondaryIndexes =
+ replSetConfig.members[rst.getNodeId(secondary)].buildIndexes !== false;
primaryCollections.forEach(collName => {
var primaryCollStats =
primary.getDB(dbName).runCommand({collStats: collName});
@@ -1928,7 +1931,8 @@ var ReplSetTest = function(opts) {
printCollectionInfo('secondary', secondary, dbName, collName);
success = false;
} else if (primaryCollStats.capped !== secondaryCollStats.capped ||
- primaryCollStats.nindexes !== secondaryCollStats.nindexes ||
+ (hasSecondaryIndexes &&
+ primaryCollStats.nindexes !== secondaryCollStats.nindexes) ||
primaryCollStats.ns !== secondaryCollStats.ns) {
print(msgPrefix +
', the primary and secondary have different stats for the ' +