diff options
author | Sanika Phanse <sanika.phanse@mongodb.com> | 2022-02-14 17:24:22 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-02-14 17:40:00 +0000 |
commit | fe1bea5e919bd5cf1d65568704f2087267706938 (patch) | |
tree | 683b9cab5fbff280f6d29005cf8eea60c7f732ec | |
parent | b5fe7d803e9183f0f09d86b3302dba600e2f8703 (diff) | |
download | mongo-fe1bea5e919bd5cf1d65568704f2087267706938.tar.gz |
SERVER-57662 Wait for config.system.sessions collection to exist on the config server before refreshing logical session cache
-rw-r--r-- | src/mongo/shell/shardingtest.js | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/mongo/shell/shardingtest.js b/src/mongo/shell/shardingtest.js index 8040ab2234b..ae2e22ca690 100644 --- a/src/mongo/shell/shardingtest.js +++ b/src/mongo/shell/shardingtest.js @@ -1762,19 +1762,6 @@ var ShardingTest = function(params) { throw e; } - // Ensure that all CSRS nodes are up to date. This is strictly needed for tests that use - // multiple mongoses. In those cases, the first mongos initializes the contents of the 'config' - // database, but without waiting for those writes to replicate to all the config servers then - // the secondary mongoses risk reading from a stale config server and seeing an empty config - // database. - this.configRS.awaitLastOpCommitted(); - - if (jsTestOptions().keyFile) { - jsTest.authenticate(configConnection); - jsTest.authenticateNodes(this._configServers); - jsTest.authenticateNodes(this._mongos); - } - // Ensure that the sessions collection exists so jstests can run things with // logical sessions and test them. We do this by forcing an immediate cache refresh // on the config server, which auto-shards the collection for the cluster. @@ -1787,6 +1774,19 @@ var ShardingTest = function(params) { MongoRunner.getBinVersionFor(otherParams.configOptions.binVersion)))) { this.configRS.getPrimary().getDB("admin").runCommand({refreshLogicalSessionCacheNow: 1}); + // Ensure that all CSRS nodes are up to date. This is strictly needed for tests that use + // multiple mongoses. In those cases, the first mongos initializes the contents of the + // 'config' database, but without waiting for those writes to replicate to all the config + // servers then the secondary mongoses risk reading from a stale config server and seeing an + // empty config database. + this.configRS.awaitLastOpCommitted(); + + if (jsTestOptions().keyFile) { + jsTest.authenticate(configConnection); + jsTest.authenticateNodes(this._configServers); + jsTest.authenticateNodes(this._mongos); + } + const x509AuthRequired = (mongosOptions[0] && mongosOptions[0].clusterAuthMode && mongosOptions[0].clusterAuthMode === "x509"); |