diff options
author | Gregory Noma <gregory.noma@gmail.com> | 2022-05-03 13:20:13 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-05-03 14:28:43 +0000 |
commit | fe08161c8c50c5fc2ea245ca248a7a05f9c3cdc6 (patch) | |
tree | 984648b542432b57fa9a83c7c808c7eb894b1f8c /src | |
parent | 497bbb6faf83673f226a34988e0d75ad62e2020d (diff) | |
download | mongo-fe08161c8c50c5fc2ea245ca248a7a05f9c3cdc6.tar.gz |
SERVER-54394 Remove `setAvoidSnapshotForRefresh_ForTest`
Diffstat (limited to 'src')
4 files changed, 6 insertions, 30 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_mock.cpp b/src/mongo/db/repl/replication_coordinator_mock.cpp index 22118c874aa..89db6e58003 100644 --- a/src/mongo/db/repl/replication_coordinator_mock.cpp +++ b/src/mongo/db/repl/replication_coordinator_mock.cpp @@ -240,6 +240,8 @@ void ReplicationCoordinatorMock::_setMyLastAppliedOpTimeAndWallTime( _myLastAppliedOpTime = opTimeAndWallTime.opTime; _myLastAppliedWallTime = opTimeAndWallTime.wallTime; + setCurrentCommittedSnapshotOpTime(opTimeAndWallTime.opTime); + if (auto storageEngine = _service->getStorageEngine()) { if (auto snapshotManager = storageEngine->getSnapshotManager()) { snapshotManager->setCommittedSnapshot(opTimeAndWallTime.opTime.getTimestamp()); diff --git a/src/mongo/db/s/config/config_server_test_fixture.cpp b/src/mongo/db/s/config/config_server_test_fixture.cpp index 6efbdd6d15c..05cb045f5ae 100644 --- a/src/mongo/db/s/config/config_server_test_fixture.cpp +++ b/src/mongo/db/s/config/config_server_test_fixture.cpp @@ -144,7 +144,6 @@ void ConfigServerTestFixture::_setUp(std::function<void()> onPreInitGlobalStateF _addShardNetworkTestEnv = std::make_unique<NetworkTestEnv>(_executorForAddShard, _mockNetworkForAddShard); auto configServerCatalogCacheLoader = std::make_unique<ConfigServerCatalogCacheLoader>(); - configServerCatalogCacheLoader->setAvoidSnapshotForRefresh_ForTest(); CatalogCacheLoader::set(getServiceContext(), std::move(configServerCatalogCacheLoader)); onPreInitGlobalStateFn(); diff --git a/src/mongo/s/config_server_catalog_cache_loader.cpp b/src/mongo/s/config_server_catalog_cache_loader.cpp index 3910e1e4c88..989ecff4858 100644 --- a/src/mongo/s/config_server_catalog_cache_loader.cpp +++ b/src/mongo/s/config_server_catalog_cache_loader.cpp @@ -54,20 +54,13 @@ namespace { */ CollectionAndChangedChunks getChangedChunks(OperationContext* opCtx, const NamespaceString& nss, - ChunkVersion sinceVersion, - bool avoidSnapshotForRefresh) { + ChunkVersion sinceVersion) { const auto readConcern = [&]() -> repl::ReadConcernArgs { - // TODO SERVER-54394 always use snapshot read concern once - // ephemeral storage engine supports it - const auto readConcernLevel = !avoidSnapshotForRefresh - ? repl::ReadConcernLevel::kSnapshotReadConcern - : repl::ReadConcernLevel::kLocalReadConcern; - if (serverGlobalParams.clusterRole == ClusterRole::ConfigServer) { - return {readConcernLevel}; + return {repl::ReadConcernLevel::kSnapshotReadConcern}; } else { const auto vcTime = VectorClock::get(opCtx)->getTime(); - return {vcTime.configTime(), readConcernLevel}; + return {vcTime.configTime(), repl::ReadConcernLevel::kSnapshotReadConcern}; } }(); @@ -142,7 +135,7 @@ SemiFuture<CollectionAndChangedChunks> ConfigServerCatalogCacheLoader::getChunks getGlobalServiceContext()); auto opCtx = tc->makeOperationContext(); - return getChangedChunks(opCtx.get(), nss, version, _avoidSnapshotForRefresh); + return getChangedChunks(opCtx.get(), nss, version); }) .semi(); } @@ -160,8 +153,4 @@ SemiFuture<DatabaseType> ConfigServerCatalogCacheLoader::getDatabase(StringData .semi(); } -void ConfigServerCatalogCacheLoader::setAvoidSnapshotForRefresh_ForTest() { - _avoidSnapshotForRefresh = true; -} - } // namespace mongo diff --git a/src/mongo/s/config_server_catalog_cache_loader.h b/src/mongo/s/config_server_catalog_cache_loader.h index 8c1384946f8..d16ae428b7f 100644 --- a/src/mongo/s/config_server_catalog_cache_loader.h +++ b/src/mongo/s/config_server_catalog_cache_loader.h @@ -55,23 +55,9 @@ public: ChunkVersion version) override; SemiFuture<DatabaseType> getDatabase(StringData dbName) override; - /** - * Don't use outside of unit_tests. - * TODO SERVER-54394 Remove this - */ - void setAvoidSnapshotForRefresh_ForTest(); - private: // Thread pool to be used to perform metadata load std::shared_ptr<ThreadPool> _executor; - - /* - * If 'true' avoids using snapshot read concern when refreshing the cache. Only to be used by - * unit_tests that use the ephemeralForTesting storage engine, because currently it doesn't - * support snapshot read concern. - * TODO SERVER-54394 Remove this. - */ - bool _avoidSnapshotForRefresh = false; }; } // namespace mongo |