summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Taskov <alex.taskov@mongodb.com>2019-10-07 20:38:48 +0000
committerevergreen <evergreen@mongodb.com>2019-10-07 20:38:48 +0000
commit20e79fa97137b1d7afb64e451a3ba7840ab05920 (patch)
tree3cc07dc1abd799dd1dd61fd66a128fae8ec8a814
parentf7bb498a2544a9b513d6d361c0f6950520d82846 (diff)
downloadmongo-20e79fa97137b1d7afb64e451a3ba7840ab05920.tar.gz
SERVER-42866 Trigger a logical session cache refresh on all shards in the ShardedCluster test fixture before running test
(cherry picked from commit 108425fdd063a0c7dae50b2d48d3dadea35a0557)
-rw-r--r--buildscripts/resmokelib/testing/fixtures/shardedcluster.py5
-rw-r--r--src/mongo/shell/shardingtest.js9
2 files changed, 14 insertions, 0 deletions
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});
+ }
+ }
}
};