diff options
Diffstat (limited to 'src/mongo/s/catalog_cache_test_fixture.cpp')
-rw-r--r-- | src/mongo/s/catalog_cache_test_fixture.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mongo/s/catalog_cache_test_fixture.cpp b/src/mongo/s/catalog_cache_test_fixture.cpp index 71e02e67fac..4f59eeaef8a 100644 --- a/src/mongo/s/catalog_cache_test_fixture.cpp +++ b/src/mongo/s/catalog_cache_test_fixture.cpp @@ -81,6 +81,26 @@ CatalogCacheTestFixture::scheduleRoutingInfoUnforcedRefresh(const NamespaceStrin }); } +executor::NetworkTestEnv::FutureHandle<boost::optional<ChunkManager>> +CatalogCacheTestFixture::scheduleRoutingInfoIncrementalRefresh(const NamespaceString& nss) { + auto catalogCache = Grid::get(getServiceContext())->catalogCache(); + const auto cm = + uassertStatusOK(catalogCache->getCollectionRoutingInfo(operationContext(), nss)); + ASSERT(cm.isSharded()); + + // Simulates the shard wanting a higher version than the one sent by the router. + catalogCache->invalidateShardOrEntireCollectionEntryForShardedCollection( + nss, boost::none, cm.dbPrimary()); + + return launchAsync([this, nss] { + auto client = getServiceContext()->makeClient("Test"); + auto const catalogCache = Grid::get(getServiceContext())->catalogCache(); + + return boost::make_optional( + uassertStatusOK(catalogCache->getCollectionRoutingInfo(operationContext(), nss))); + }); +} + std::vector<ShardType> CatalogCacheTestFixture::setupNShards(int numShards) { std::vector<ShardType> shards; for (int i = 0; i < numShards; i++) { |