diff options
author | Henrik Edin <henrik.edin@mongodb.com> | 2018-02-27 11:28:53 -0500 |
---|---|---|
committer | Henrik Edin <henrik.edin@mongodb.com> | 2018-03-02 09:58:48 -0500 |
commit | 7d37a75df3f6035a7afcb51123b88f0e99308fc8 (patch) | |
tree | 2f2a0b3f835ca14830208a3f894dd4e04a7e8cd0 /src/mongo/dbtests | |
parent | 0b8094a34b9458ad46cf05cf67015d83725934b7 (diff) | |
download | mongo-7d37a75df3f6035a7afcb51123b88f0e99308fc8.tar.gz |
SERVER-29519 Remove getGlobalReplicationCoordinator. Replace when getting decoration through service context (global if needed).
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r-- | src/mongo/dbtests/SConscript | 2 | ||||
-rw-r--r-- | src/mongo/dbtests/dbtests.cpp | 10 | ||||
-rw-r--r-- | src/mongo/dbtests/repltests.cpp | 20 | ||||
-rw-r--r-- | src/mongo/dbtests/storage_timestamp_tests.cpp | 9 |
4 files changed, 26 insertions, 15 deletions
diff --git a/src/mongo/dbtests/SConscript b/src/mongo/dbtests/SConscript index 93e46007afc..ca58e8a4c4b 100644 --- a/src/mongo/dbtests/SConscript +++ b/src/mongo/dbtests/SConscript @@ -129,7 +129,7 @@ dbtest = env.Program( "$BUILD_DIR/mongo/db/query/query_planner_test_lib", "$BUILD_DIR/mongo/db/query/query_test_service_context", "$BUILD_DIR/mongo/db/repl/drop_pending_collection_reaper", - "$BUILD_DIR/mongo/db/repl/repl_coordinator_global", + "$BUILD_DIR/mongo/db/repl/repl_coordinator_interface", "$BUILD_DIR/mongo/db/repl/replication_consistency_markers_impl", "$BUILD_DIR/mongo/db/repl/replmocks", "$BUILD_DIR/mongo/db/repl/storage_interface_impl", diff --git a/src/mongo/dbtests/dbtests.cpp b/src/mongo/dbtests/dbtests.cpp index 3cf58407b53..c70cd36807f 100644 --- a/src/mongo/dbtests/dbtests.cpp +++ b/src/mongo/dbtests/dbtests.cpp @@ -44,7 +44,7 @@ #include "mongo/db/index/index_descriptor.h" #include "mongo/db/logical_clock.h" #include "mongo/db/repl/drop_pending_collection_reaper.h" -#include "mongo/db/repl/replication_coordinator_global.h" +#include "mongo/db/repl/replication_coordinator.h" #include "mongo/db/repl/replication_coordinator_mock.h" #include "mongo/db/repl/storage_interface_mock.h" #include "mongo/db/service_context.h" @@ -152,9 +152,11 @@ int dbtestsMain(int argc, char** argv, char** envp) { preciseClock->advance(Seconds(1)); service->setPreciseClockSource(std::move(preciseClock)); - repl::setGlobalReplicationCoordinator( - new repl::ReplicationCoordinatorMock(service, replSettings)); - repl::getGlobalReplicationCoordinator() + repl::ReplicationCoordinator::set( + service, + std::unique_ptr<repl::ReplicationCoordinator>( + new repl::ReplicationCoordinatorMock(service, replSettings))); + repl::ReplicationCoordinator::get(getGlobalServiceContext()) ->setFollowerMode(repl::MemberState::RS_PRIMARY) .ignore(); diff --git a/src/mongo/dbtests/repltests.cpp b/src/mongo/dbtests/repltests.cpp index cf66f4a4299..6306c4ce0db 100644 --- a/src/mongo/dbtests/repltests.cpp +++ b/src/mongo/dbtests/repltests.cpp @@ -48,7 +48,7 @@ #include "mongo/db/repl/master_slave.h" #include "mongo/db/repl/oplog.h" #include "mongo/db/repl/repl_client_info.h" -#include "mongo/db/repl/replication_coordinator_global.h" +#include "mongo/db/repl/replication_coordinator.h" #include "mongo/db/repl/replication_coordinator_mock.h" #include "mongo/db/repl/sync_tail.h" #include "mongo/dbtests/dbtests.h" @@ -102,7 +102,9 @@ protected: public: Base() - : _client(&_opCtx), _defaultReplSettings(getGlobalReplicationCoordinator()->getSettings()) { + : _client(&_opCtx), + _defaultReplSettings( + ReplicationCoordinator::get(getGlobalServiceContext())->getSettings()) { // Replication is not supported by mobile SE. if (mongo::storageGlobalParams.engine == "mobile") { return; @@ -110,8 +112,10 @@ public: ReplSettings replSettings; replSettings.setOplogSizeBytes(10 * 1024 * 1024); replSettings.setMaster(true); - setGlobalReplicationCoordinator( - new repl::ReplicationCoordinatorMock(_opCtx.getServiceContext(), replSettings)); + ReplicationCoordinator::set( + getGlobalServiceContext(), + std::unique_ptr<repl::ReplicationCoordinator>( + new repl::ReplicationCoordinatorMock(_opCtx.getServiceContext(), replSettings))); // Since the Client object persists across tests, even though the global // ReplicationCoordinator does not, we need to clear the last op associated with the client @@ -142,9 +146,11 @@ public: try { deleteAll(ns()); deleteAll(cllNS()); - setGlobalReplicationCoordinator(new repl::ReplicationCoordinatorMock( - _opCtx.getServiceContext(), _defaultReplSettings)); - repl::getGlobalReplicationCoordinator() + repl::ReplicationCoordinator::set( + getGlobalServiceContext(), + std::unique_ptr<repl::ReplicationCoordinator>(new repl::ReplicationCoordinatorMock( + _opCtx.getServiceContext(), _defaultReplSettings))); + repl::ReplicationCoordinator::get(getGlobalServiceContext()) ->setFollowerMode(repl::MemberState::RS_PRIMARY) .ignore(); diff --git a/src/mongo/dbtests/storage_timestamp_tests.cpp b/src/mongo/dbtests/storage_timestamp_tests.cpp index 96ae39ebe48..e04f1a6e9cf 100644 --- a/src/mongo/dbtests/storage_timestamp_tests.cpp +++ b/src/mongo/dbtests/storage_timestamp_tests.cpp @@ -57,7 +57,7 @@ #include "mongo/db/repl/repl_client_info.h" #include "mongo/db/repl/replication_consistency_markers_impl.h" #include "mongo/db/repl/replication_consistency_markers_mock.h" -#include "mongo/db/repl/replication_coordinator_global.h" +#include "mongo/db/repl/replication_coordinator.h" #include "mongo/db/repl/replication_coordinator_mock.h" #include "mongo/db/repl/replication_process.h" #include "mongo/db/repl/replication_recovery_mock.h" @@ -103,7 +103,9 @@ public: new repl::ReplicationCoordinatorMock(_opCtx->getServiceContext(), replSettings); _coordinatorMock = coordinatorMock; coordinatorMock->alwaysAllowWrites(true); - setGlobalReplicationCoordinator(coordinatorMock); + repl::ReplicationCoordinator::set( + _opCtx->getServiceContext(), + std::unique_ptr<repl::ReplicationCoordinator>(coordinatorMock)); repl::StorageInterface::set(_opCtx->getServiceContext(), stdx::make_unique<repl::StorageInterfaceImpl>()); @@ -300,7 +302,8 @@ public: } void setReplCoordAppliedOpTime(const repl::OpTime& opTime) { - repl::getGlobalReplicationCoordinator()->setMyLastAppliedOpTime(opTime); + repl::ReplicationCoordinator::get(getGlobalServiceContext()) + ->setMyLastAppliedOpTime(opTime); } /** |