summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Mulrow <jack.mulrow@mongodb.com>2020-03-24 18:36:23 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-26 23:25:10 +0000
commitc1b56a30d3b445715bbbe302215dedc748ceb86f (patch)
treed9ad9d2096f35ee2aaedb053ee1e7bbf1d885de8
parentc5eea7753b2fe3082d853ff9400117c85ac42dab (diff)
downloadmongo-c1b56a30d3b445715bbbe302215dedc748ceb86f.tar.gz
SERVER-47099 Remove FCV logic from periodic sharded index checker
-rw-r--r--jstests/multiVersion/sharded_index_consistency_metrics.js89
-rw-r--r--jstests/noPassthrough/sharded_index_consistency_metrics.js5
-rw-r--r--jstests/noPassthrough/sharded_index_consistency_metrics_stale_version_retries.js4
-rw-r--r--src/mongo/db/s/periodic_sharded_index_consistency_checker.cpp17
4 files changed, 4 insertions, 111 deletions
diff --git a/jstests/multiVersion/sharded_index_consistency_metrics.js b/jstests/multiVersion/sharded_index_consistency_metrics.js
deleted file mode 100644
index 195661fd404..00000000000
--- a/jstests/multiVersion/sharded_index_consistency_metrics.js
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * Tests that the index consistency serverStatus metrics are only tracked when FCV is 4.4.
- */
-(function() {
-"use strict";
-
-load("jstests/multiVersion/libs/multi_cluster.js"); // upgradeCluster
-load("jstests/multiVersion/libs/multi_rs.js"); // upgradeSet
-load("jstests/multiVersion/libs/verify_versions.js");
-load("jstests/noPassthrough/libs/sharded_index_consistency_metrics_helpers.js");
-
-// This test creates inconsistent indexes.
-TestData.skipCheckingIndexesConsistentAcrossCluster = true;
-// Checking UUID consistency uses cached connections, which are not valid across restarts or
-// stepdowns.
-TestData.skipCheckingUUIDsConsistentAcrossCluster = true;
-
-// Set up a mixed version cluster with only the config servers running the latest binary.
-const intervalMS = 1000;
-const st = new ShardingTest({
- shards: 2,
- other: {
- mongosOptions: {binVersion: "last-stable"},
- configOptions: {
- binVersion: "latest",
- setParameter: {"shardedIndexConsistencyCheckIntervalMS": intervalMS}
- },
- rsOptions: {binVersion: "last-stable"},
- },
- rs: {nodes: 3}
-});
-const dbName = "test";
-const ns = dbName + ".foo";
-
-assert.binVersion(st.shard0, "last-stable");
-assert.binVersion(st.shard1, "last-stable");
-assert.binVersion(st.s0, "last-stable");
-checkFCV(st.configRS.getPrimary().getDB("admin"), lastStableFCV);
-
-assert.commandWorked(st.s.adminCommand({enableSharding: dbName}));
-st.ensurePrimaryShard(dbName, st.shard0.shardName);
-assert.commandWorked(st.s.adminCommand({shardCollection: ns, key: {_id: "hashed"}}));
-
-//
-// Verify the inconsistent indexes counter is never greater than 0 in a mixed version cluster with
-// 4.4 binary config servers.
-//
-
-checkServerStatusNumCollsWithInconsistentIndexes(st.configRS.getPrimary(), 0);
-
-// Create an inconsistent index and verify it isn't reflected by the counter.
-assert.commandWorked(st.shard0.getCollection(ns).createIndex({x: 1}));
-sleep(intervalMS * 2); // Sleep to let the index check run.
-checkServerStatusNumCollsWithInconsistentIndexes(st.configRS.getPrimary(), 0);
-
-//
-// Verify the counter is 0 until the cluster's FCV is upgraded to 4.4.
-//
-
-jsTestLog("Upgrading shard servers.");
-st.upgradeCluster("latest", {upgradeMongos: false, upgradeConfigs: false, upgradeShards: true});
-
-jsTestLog("Upgrading mongos servers.");
-st.upgradeCluster("latest", {upgradeMongos: true, upgradeConfigs: false, upgradeShards: false});
-
-sleep(intervalMS * 2); // Sleep to let the index check run.
-checkServerStatusNumCollsWithInconsistentIndexes(st.configRS.getPrimary(), 0);
-
-jsTestLog("Upgrading feature compatibility version to latest.");
-assert.commandWorked(st.s.getDB("admin").runCommand({setFeatureCompatibilityVersion: latestFCV}));
-checkFCV(st.configRS.getPrimary().getDB("admin"), latestFCV);
-
-// Now the counter should pick up the inconsistency.
-checkServerStatusNumCollsWithInconsistentIndexes(st.configRS.getPrimary(), 1);
-
-//
-// Verify the counter returns to 0 when the cluster's FCV is downgraded to 4.2.
-//
-
-jsTestLog("Downgrading feature compatibility version to last-stable.");
-assert.commandWorked(
- st.s.getDB("admin").runCommand({setFeatureCompatibilityVersion: lastStableFCV}));
-checkFCV(st.configRS.getPrimary().getDB("admin"), lastStableFCV);
-
-// The count should return to 0, despite the inconsistency remaining.
-checkServerStatusNumCollsWithInconsistentIndexes(st.configRS.getPrimary(), 0);
-
-st.stop();
-})();
diff --git a/jstests/noPassthrough/sharded_index_consistency_metrics.js b/jstests/noPassthrough/sharded_index_consistency_metrics.js
index c5d476bc159..61217e211ac 100644
--- a/jstests/noPassthrough/sharded_index_consistency_metrics.js
+++ b/jstests/noPassthrough/sharded_index_consistency_metrics.js
@@ -1,7 +1,6 @@
/*
- * Tests index consistency metrics in the serverStatus output. These metrics are only correct in FCV
- * 4.4, so this test requires it.
- * @tags: [requires_fcv_44, requires_sharding]
+ * Tests index consistency metrics in the serverStatus output.
+ * @tags: [requires_sharding]
*/
(function() {
"use strict";
diff --git a/jstests/noPassthrough/sharded_index_consistency_metrics_stale_version_retries.js b/jstests/noPassthrough/sharded_index_consistency_metrics_stale_version_retries.js
index d005c385d25..698f5ba6e14 100644
--- a/jstests/noPassthrough/sharded_index_consistency_metrics_stale_version_retries.js
+++ b/jstests/noPassthrough/sharded_index_consistency_metrics_stale_version_retries.js
@@ -1,7 +1,7 @@
/*
* Tests the aggregation that collects index consistency metrics for serverStatus retries on stale
- * version errors. These metrics are only correct in FCV 4.4, so this test requires it.
- * @tags: [requires_fcv_44, requires_sharding]
+ * version errors.
+ * @tags: [requires_sharding]
*/
(function() {
"use strict";
diff --git a/src/mongo/db/s/periodic_sharded_index_consistency_checker.cpp b/src/mongo/db/s/periodic_sharded_index_consistency_checker.cpp
index 44d6de76ade..ec050ac8f62 100644
--- a/src/mongo/db/s/periodic_sharded_index_consistency_checker.cpp
+++ b/src/mongo/db/s/periodic_sharded_index_consistency_checker.cpp
@@ -79,23 +79,6 @@ void PeriodicShardedIndexConsistencyChecker::_launchShardedIndexConsistencyCheck
return;
}
- if (serverGlobalParams.featureCompatibility.getVersion() !=
- ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo44) {
- // Short circuit when not fully FCV upgraded because in v4.4
- // ClusterAggregate::runAggregate() attaches fields that can't be parsed by a 4.2
- // mongod. This is not a problem for aggregations run through mongos, because mongos
- // won't connect to a 4.2 mongod, but this aggregation is run by the config server
- // and will fail in a mixed version cluster. A config server can only be in FCV 4.4
- // if all shards are running a 4.4 binary, which avoids this problem at the expense
- // of not detecting inconsistent indexes when FCV < 4.4.
- LOGV2(4608400,
- "Skipping sharded index consistency check because feature compatibility "
- "version is not fully upgraded");
- stdx::lock_guard<Latch> lk(_mutex);
- _numShardedCollsWithInconsistentIndexes = 0;
- return;
- }
-
LOGV2(22049, "Checking consistency of sharded collection indexes across the cluster");
const auto aggRequestBSON = fromjson(