From 20e79fa97137b1d7afb64e451a3ba7840ab05920 Mon Sep 17 00:00:00 2001 From: Alex Taskov Date: Mon, 7 Oct 2019 20:38:48 +0000 Subject: SERVER-42866 Trigger a logical session cache refresh on all shards in the ShardedCluster test fixture before running test (cherry picked from commit 108425fdd063a0c7dae50b2d48d3dadea35a0557) --- buildscripts/resmokelib/testing/fixtures/shardedcluster.py | 5 +++++ src/mongo/shell/shardingtest.js | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/buildscripts/resmokelib/testing/fixtures/shardedcluster.py b/buildscripts/resmokelib/testing/fixtures/shardedcluster.py index b3b744095ef..f2a6814b171 100644 --- a/buildscripts/resmokelib/testing/fixtures/shardedcluster.py +++ b/buildscripts/resmokelib/testing/fixtures/shardedcluster.py @@ -140,6 +140,11 @@ class ShardedClusterFixture(interface.Fixture): # pylint: disable=too-many-inst primary = self.configsvr.get_primary().mongo_client() primary.admin.command({"refreshLogicalSessionCacheNow": 1}) + for shard in self.shards: + primary = (shard.mongo_client() if self.num_rs_nodes_per_shard is None else + shard.get_primary().mongo_client()) + primary.admin.command({"refreshLogicalSessionCacheNow": 1}) + def _auth_to_db(self, client): """Authenticate client for the 'authenticationDatabase'.""" if self.auth_options is not None: diff --git a/src/mongo/shell/shardingtest.js b/src/mongo/shell/shardingtest.js index 6008c769202..8f33e5445ae 100644 --- a/src/mongo/shell/shardingtest.js +++ b/src/mongo/shell/shardingtest.js @@ -1619,6 +1619,15 @@ var ShardingTest = function(params) { lastStableBinVersion, MongoRunner.getBinVersionFor(otherParams.configOptions.binVersion)))) { this.configRS.getPrimary().getDB("admin").runCommand({refreshLogicalSessionCacheNow: 1}); + + for (let i = 0; i < numShards; i++) { + if (otherParams.rs || otherParams["rs" + i] || startShardsAsRS) { + const rs = this._rs[i].test; + rs.getPrimary().getDB("admin").runCommand({_flushRoutingTableCacheUpdatesCmd: 1}); + } else { + this["shard" + i].getDB("admin").runCommand({_flushRoutingTableCacheUpdatesCmd: 1}); + } + } } }; -- cgit v1.2.1