diff options
author | Paolo Polato <paolo.polato@mongodb.com> | 2022-10-17 10:16:26 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-10-17 10:46:28 +0000 |
commit | 613df409e8e545cefb494c140565bdbe85838ce2 (patch) | |
tree | 00144667efe57fad422de899b68610edbbc4459b /jstests/sharding/sessions_collection_auto_healing.js | |
parent | 4826dded41f235887cd472845227926e4c86acd5 (diff) | |
download | mongo-613df409e8e545cefb494c140565bdbe85838ce2.tar.gz |
SERVER-68927 Store placement changes into config.placementHistory when a shardCollection() command gets committed on the config server
Diffstat (limited to 'jstests/sharding/sessions_collection_auto_healing.js')
-rw-r--r-- | jstests/sharding/sessions_collection_auto_healing.js | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/jstests/sharding/sessions_collection_auto_healing.js b/jstests/sharding/sessions_collection_auto_healing.js index 5689c4fd3ec..109b8fe96d0 100644 --- a/jstests/sharding/sessions_collection_auto_healing.js +++ b/jstests/sharding/sessions_collection_auto_healing.js @@ -3,6 +3,7 @@ * ] */ load('jstests/libs/sessions_collection.js'); +load("jstests/libs/feature_flag_util.js"); (function() { "use strict"; @@ -119,19 +120,30 @@ var shardConfig = shard.getDB("config"); validateSessionsCollection(shard, true, true); - // We will have two sessions because of the session used in the shardCollection's retryable - // write to shard the sessions collection. It will disappear after we run the refresh - // function on the shard. - assert.eq(shardConfig.system.sessions.countDocuments({}), 2, "did not flush config's sessions"); + // TODO SERVER-69106 adapt the test assuming that the flag will be always enabled. + const historicalPlacementDataFeatureFlag = FeatureFlagUtil.isEnabled( + st.configRS.getPrimary().getDB('admin'), "HistoricalPlacementShardingCatalog"); + const sessionsOpenedByShardCollectionCmd = historicalPlacementDataFeatureFlag ? 3 : 2; + + // We will have sessionsOpenedByShardCollectionCmd sessions because of the sessions used in the + // shardCollection's retryable write to shard the sessions collection. It will disappear after + // we run the refresh function on the shard. + assert.eq(shardConfig.system.sessions.countDocuments({}), + sessionsOpenedByShardCollectionCmd, + "did not flush config's sessions"); // Now, if we do refreshes on the other servers, their in-mem records will // be written to the collection. assert.commandWorked(shard.adminCommand({refreshLogicalSessionCacheNow: 1})); - assert.eq(shardConfig.system.sessions.countDocuments({}), 3, "did not flush shard's sessions"); + assert.eq(shardConfig.system.sessions.countDocuments({}), + sessionsOpenedByShardCollectionCmd + 1, + "did not flush shard's sessions"); rs.awaitLastOpCommitted(); assert.commandWorked(mongos.adminCommand({refreshLogicalSessionCacheNow: 1})); - assert.eq(shardConfig.system.sessions.countDocuments({}), 5, "did not flush mongos' sessions"); + assert.eq(shardConfig.system.sessions.countDocuments({}), + sessionsOpenedByShardCollectionCmd + 3, + "did not flush mongos' sessions"); } // Test that if we drop the index on the sessions collection, only a refresh on the config |