summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/client/embedded/service_entry_point_embedded.cpp1
-rw-r--r--src/mongo/db/SConscript4
-rw-r--r--src/mongo/db/auth/SConscript2
-rw-r--r--src/mongo/db/auth/authz_session_external_state_d.cpp9
-rw-r--r--src/mongo/db/catalog/capped_utils.cpp2
-rw-r--r--src/mongo/db/catalog/coll_mod.cpp2
-rw-r--r--src/mongo/db/catalog/collection.cpp1
-rw-r--r--src/mongo/db/catalog/collection_impl.cpp2
-rw-r--r--src/mongo/db/catalog/database_impl.cpp2
-rw-r--r--src/mongo/db/catalog/drop_collection.cpp2
-rw-r--r--src/mongo/db/catalog/drop_indexes.cpp2
-rw-r--r--src/mongo/db/catalog/index_catalog_impl.cpp2
-rw-r--r--src/mongo/db/catalog/index_create.cpp1
-rw-r--r--src/mongo/db/catalog/rename_collection.cpp2
-rw-r--r--src/mongo/db/clientcursor.cpp2
-rw-r--r--src/mongo/db/cloner.cpp2
-rw-r--r--src/mongo/db/commands/SConscript2
-rw-r--r--src/mongo/db/commands/apply_ops_cmd.cpp1
-rw-r--r--src/mongo/db/commands/collection_to_capped.cpp2
-rw-r--r--src/mongo/db/commands/compact.cpp2
-rw-r--r--src/mongo/db/commands/conn_pool_stats.cpp1
-rw-r--r--src/mongo/db/commands/count_cmd.cpp2
-rw-r--r--src/mongo/db/commands/create_indexes.cpp2
-rw-r--r--src/mongo/db/commands/dbcommands.cpp2
-rw-r--r--src/mongo/db/commands/do_txn_cmd.cpp1
-rw-r--r--src/mongo/db/commands/drop_indexes.cpp2
-rw-r--r--src/mongo/db/commands/explain_cmd.cpp1
-rw-r--r--src/mongo/db/commands/find_and_modify.cpp2
-rw-r--r--src/mongo/db/commands/get_last_error.cpp2
-rw-r--r--src/mongo/db/commands/getmore_cmd.cpp2
-rw-r--r--src/mongo/db/commands/mr.cpp2
-rw-r--r--src/mongo/db/commands/oplog_note.cpp1
-rw-r--r--src/mongo/db/commands/rename_collection_cmd.cpp2
-rw-r--r--src/mongo/db/commands/set_feature_compatibility_version_command.cpp2
-rw-r--r--src/mongo/db/commands/test_commands.cpp1
-rw-r--r--src/mongo/db/commands/write_commands/write_commands.cpp2
-rw-r--r--src/mongo/db/db.cpp2
-rw-r--r--src/mongo/db/exec/delete.cpp2
-rw-r--r--src/mongo/db/exec/update.cpp2
-rw-r--r--src/mongo/db/ftdc/SConscript2
-rw-r--r--src/mongo/db/ftdc/ftdc_mongod.cpp3
-rw-r--r--src/mongo/db/log_process_details.cpp1
-rw-r--r--src/mongo/db/ops/parsed_delete.cpp1
-rw-r--r--src/mongo/db/ops/update.cpp2
-rw-r--r--src/mongo/db/prefetch.cpp10
-rw-r--r--src/mongo/db/query/get_executor.cpp2
-rw-r--r--src/mongo/db/repair_database_and_check_version.cpp6
-rw-r--r--src/mongo/db/repl/SConscript15
-rw-r--r--src/mongo/db/repl/apply_ops.cpp2
-rw-r--r--src/mongo/db/repl/bgsync.cpp2
-rw-r--r--src/mongo/db/repl/do_txn.cpp2
-rw-r--r--src/mongo/db/repl/idempotency_test_fixture.cpp1
-rw-r--r--src/mongo/db/repl/master_slave.cpp5
-rw-r--r--src/mongo/db/repl/oplog.cpp2
-rw-r--r--src/mongo/db/repl/repl_set_commands.cpp5
-rw-r--r--src/mongo/db/repl/repl_set_request_votes.cpp2
-rw-r--r--src/mongo/db/repl/replication_coordinator_external_state_impl.cpp2
-rw-r--r--src/mongo/db/repl/replication_coordinator_global.cpp48
-rw-r--r--src/mongo/db/repl/replication_coordinator_global.h40
-rw-r--r--src/mongo/db/repl/replication_info.cpp2
-rw-r--r--src/mongo/db/repl/resync.cpp2
-rw-r--r--src/mongo/db/repl/storage_interface_impl.cpp1
-rw-r--r--src/mongo/db/repl/sync_tail.cpp1
-rw-r--r--src/mongo/db/repl/sync_tail_test.cpp17
-rw-r--r--src/mongo/db/s/SConscript2
-rw-r--r--src/mongo/db/s/chunk_move_write_concern_options.cpp2
-rw-r--r--src/mongo/db/s/sharding_egress_metadata_hook_for_mongod.cpp2
-rw-r--r--src/mongo/db/service_entry_point_common.cpp2
-rw-r--r--src/mongo/db/storage/ephemeral_for_test/SConscript2
-rw-r--r--src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_recovery_unit.cpp1
-rw-r--r--src/mongo/db/storage/kv/kv_storage_engine_test.cpp7
-rw-r--r--src/mongo/db/ttl.cpp2
-rw-r--r--src/mongo/db/views/view_sharding_check.cpp2
-rw-r--r--src/mongo/db/write_concern.cpp2
-rw-r--r--src/mongo/dbtests/SConscript2
-rw-r--r--src/mongo/dbtests/dbtests.cpp10
-rw-r--r--src/mongo/dbtests/repltests.cpp20
-rw-r--r--src/mongo/dbtests/storage_timestamp_tests.cpp9
-rw-r--r--src/mongo/s/SConscript2
-rw-r--r--src/mongo/s/client/SConscript2
-rw-r--r--src/mongo/s/client/shard_local.cpp6
-rw-r--r--src/mongo/s/client/shard_local_test.cpp14
82 files changed, 217 insertions, 126 deletions
diff --git a/src/mongo/client/embedded/service_entry_point_embedded.cpp b/src/mongo/client/embedded/service_entry_point_embedded.cpp
index d5e46c2329b..13bee2a44f0 100644
--- a/src/mongo/client/embedded/service_entry_point_embedded.cpp
+++ b/src/mongo/client/embedded/service_entry_point_embedded.cpp
@@ -58,6 +58,7 @@
#include "mongo/db/repl/optime.h"
#include "mongo/db/repl/read_concern_args.h"
#include "mongo/db/repl/repl_client_info.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/s/operation_sharding_state.h"
#include "mongo/db/s/sharded_connection_info.h"
#include "mongo/db/s/sharding_state.h"
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript
index 7ac4aa70a8b..0145ab406d4 100644
--- a/src/mongo/db/SConscript
+++ b/src/mongo/db/SConscript
@@ -922,6 +922,7 @@ env.Library(
'pipeline/pipeline',
'query/query_common',
'query/query_planner',
+ 'repl/repl_coordinator_global',
'repl/repl_coordinator_interface',
's/sharding',
'stats/serveronly_stats',
@@ -988,7 +989,7 @@ env.Library(
"repl/oplog_buffer_blocking_queue",
"repl/oplog_buffer_collection",
"repl/oplog_buffer_proxy",
- "repl/repl_coordinator_interface",
+ "repl/repl_coordinator_global",
"repl/repl_coordinator_impl",
"repl/repl_settings",
"repl/rs_rollback",
@@ -1618,6 +1619,7 @@ env.Library(
'log_process_details.cpp',
],
LIBDEPS=[
+ 'repl/repl_coordinator_global',
'repl/repl_coordinator_interface',
'repl/replica_set_messages',
'server_options',
diff --git a/src/mongo/db/auth/SConscript b/src/mongo/db/auth/SConscript
index 5827aa592d1..db4f9cfce13 100644
--- a/src/mongo/db/auth/SConscript
+++ b/src/mongo/db/auth/SConscript
@@ -197,7 +197,7 @@ env.Library('authmongod',
'$BUILD_DIR/mongo/db/db_raii',
'$BUILD_DIR/mongo/db/dbdirectclient',
'$BUILD_DIR/mongo/db/dbhelpers',
- '$BUILD_DIR/mongo/db/repl/repl_coordinator_interface',
+ '$BUILD_DIR/mongo/db/repl/repl_coordinator_global',
'$BUILD_DIR/mongo/db/server_parameters',
],
)
diff --git a/src/mongo/db/auth/authz_session_external_state_d.cpp b/src/mongo/db/auth/authz_session_external_state_d.cpp
index 0c8689feb10..77f0f0df856 100644
--- a/src/mongo/db/auth/authz_session_external_state_d.cpp
+++ b/src/mongo/db/auth/authz_session_external_state_d.cpp
@@ -34,7 +34,7 @@
#include "mongo/db/client.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/operation_context.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/scripting/engine.h"
#include "mongo/util/assert_util.h"
@@ -60,10 +60,9 @@ bool AuthzSessionExternalStateMongod::shouldIgnoreAuthChecks() const {
bool AuthzSessionExternalStateMongod::serverIsArbiter() const {
// Arbiters have access to extra privileges under localhost. See SERVER-5479.
- return (
- repl::ReplicationCoordinator::get(getGlobalServiceContext())->getReplicationMode() ==
- repl::ReplicationCoordinator::modeReplSet &&
- repl::ReplicationCoordinator::get(getGlobalServiceContext())->getMemberState().arbiter());
+ return (repl::getGlobalReplicationCoordinator()->getReplicationMode() ==
+ repl::ReplicationCoordinator::modeReplSet &&
+ repl::getGlobalReplicationCoordinator()->getMemberState().arbiter());
}
} // namespace mongo
diff --git a/src/mongo/db/catalog/capped_utils.cpp b/src/mongo/db/catalog/capped_utils.cpp
index 47ac06fb385..90b36990e26 100644
--- a/src/mongo/db/catalog/capped_utils.cpp
+++ b/src/mongo/db/catalog/capped_utils.cpp
@@ -47,7 +47,7 @@
#include "mongo/db/index_builder.h"
#include "mongo/db/query/internal_plans.h"
#include "mongo/db/query/plan_yield_policy.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/service_context.h"
#include "mongo/util/scopeguard.h"
diff --git a/src/mongo/db/catalog/coll_mod.cpp b/src/mongo/db/catalog/coll_mod.cpp
index b4ba7d3fdc2..9aa6e0391b3 100644
--- a/src/mongo/db/catalog/coll_mod.cpp
+++ b/src/mongo/db/catalog/coll_mod.cpp
@@ -45,7 +45,7 @@
#include "mongo/db/db_raii.h"
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/repl/repl_client_info.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/s/sharding_state.h"
#include "mongo/db/server_options.h"
#include "mongo/db/service_context.h"
diff --git a/src/mongo/db/catalog/collection.cpp b/src/mongo/db/catalog/collection.cpp
index 13bb493e5a6..6493d147605 100644
--- a/src/mongo/db/catalog/collection.cpp
+++ b/src/mongo/db/catalog/collection.cpp
@@ -53,6 +53,7 @@
#include "mongo/db/operation_context.h"
#include "mongo/db/ops/update_request.h"
#include "mongo/db/query/collation/collator_factory_interface.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
#include "mongo/db/storage/key_string.h"
diff --git a/src/mongo/db/catalog/collection_impl.cpp b/src/mongo/db/catalog/collection_impl.cpp
index 77eae4b05b9..dae6600d637 100644
--- a/src/mongo/db/catalog/collection_impl.cpp
+++ b/src/mongo/db/catalog/collection_impl.cpp
@@ -60,7 +60,7 @@
#include "mongo/db/operation_context.h"
#include "mongo/db/ops/update_request.h"
#include "mongo/db/query/collation/collator_factory_interface.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
#include "mongo/db/storage/key_string.h"
diff --git a/src/mongo/db/catalog/database_impl.cpp b/src/mongo/db/catalog/database_impl.cpp
index acaf962bcf9..62ef7317090 100644
--- a/src/mongo/db/catalog/database_impl.cpp
+++ b/src/mongo/db/catalog/database_impl.cpp
@@ -58,7 +58,7 @@
#include "mongo/db/query/collation/collator_factory_interface.h"
#include "mongo/db/repl/drop_pending_collection_reaper.h"
#include "mongo/db/repl/oplog.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/s/operation_sharding_state.h"
#include "mongo/db/server_options.h"
#include "mongo/db/server_parameters.h"
diff --git a/src/mongo/db/catalog/drop_collection.cpp b/src/mongo/db/catalog/drop_collection.cpp
index e9e816651a2..33b9acebea0 100644
--- a/src/mongo/db/catalog/drop_collection.cpp
+++ b/src/mongo/db/catalog/drop_collection.cpp
@@ -39,7 +39,7 @@
#include "mongo/db/curop.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/index_builder.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/server_options.h"
#include "mongo/db/service_context.h"
#include "mongo/db/views/view_catalog.h"
diff --git a/src/mongo/db/catalog/drop_indexes.cpp b/src/mongo/db/catalog/drop_indexes.cpp
index 10f78594b51..67a6a2f0903 100644
--- a/src/mongo/db/catalog/drop_indexes.cpp
+++ b/src/mongo/db/catalog/drop_indexes.cpp
@@ -40,7 +40,7 @@
#include "mongo/db/db_raii.h"
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/index_builder.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/service_context.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/catalog/index_catalog_impl.cpp b/src/mongo/db/catalog/index_catalog_impl.cpp
index c79a0802fa9..9d51004abd8 100644
--- a/src/mongo/db/catalog/index_catalog_impl.cpp
+++ b/src/mongo/db/catalog/index_catalog_impl.cpp
@@ -61,7 +61,7 @@
#include "mongo/db/query/collation/collator_factory_interface.h"
#include "mongo/db/query/internal_plans.h"
#include "mongo/db/repl/replication_coordinator.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/server_options.h"
#include "mongo/db/service_context.h"
#include "mongo/util/assert_util.h"
diff --git a/src/mongo/db/catalog/index_create.cpp b/src/mongo/db/catalog/index_create.cpp
index 06f9676ca4b..678e4ae6d0f 100644
--- a/src/mongo/db/catalog/index_create.cpp
+++ b/src/mongo/db/catalog/index_create.cpp
@@ -44,6 +44,7 @@
#include "mongo/db/exec/working_set_common.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/query/internal_plans.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/server_parameters.h"
#include "mongo/stdx/functional.h"
#include "mongo/stdx/mutex.h"
diff --git a/src/mongo/db/catalog/rename_collection.cpp b/src/mongo/db/catalog/rename_collection.cpp
index 3ff9792233b..eb8659b80dc 100644
--- a/src/mongo/db/catalog/rename_collection.cpp
+++ b/src/mongo/db/catalog/rename_collection.cpp
@@ -47,7 +47,7 @@
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/index_builder.h"
#include "mongo/db/jsobj.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/s/collection_sharding_state.h"
#include "mongo/db/service_context.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/clientcursor.cpp b/src/mongo/db/clientcursor.cpp
index e7c2366ffdf..ff3a3cba0c0 100644
--- a/src/mongo/db/clientcursor.cpp
+++ b/src/mongo/db/clientcursor.cpp
@@ -48,7 +48,7 @@
#include "mongo/db/cursor_server_params.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/repl/repl_client_info.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/util/background.h"
#include "mongo/util/concurrency/idle_thread_block.h"
#include "mongo/util/exit.h"
diff --git a/src/mongo/db/cloner.cpp b/src/mongo/db/cloner.cpp
index 5863621f107..22cf1a1d199 100644
--- a/src/mongo/db/cloner.cpp
+++ b/src/mongo/db/cloner.cpp
@@ -61,7 +61,7 @@
#include "mongo/db/op_observer.h"
#include "mongo/db/ops/insert.h"
#include "mongo/db/repl/isself.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
#include "mongo/db/storage/storage_options.h"
diff --git a/src/mongo/db/commands/SConscript b/src/mongo/db/commands/SConscript
index c49907e5380..550ccf28aa8 100644
--- a/src/mongo/db/commands/SConscript
+++ b/src/mongo/db/commands/SConscript
@@ -99,7 +99,7 @@ env.Library(
'$BUILD_DIR/mongo/db/logical_session_id_helpers',
'$BUILD_DIR/mongo/db/matcher/expressions',
'$BUILD_DIR/mongo/db/repl/isself',
- '$BUILD_DIR/mongo/db/repl/repl_coordinator_interface',
+ '$BUILD_DIR/mongo/db/repl/repl_coordinator_global',
'$BUILD_DIR/mongo/db/server_options',
'$BUILD_DIR/mongo/db/server_parameters',
'$BUILD_DIR/mongo/db/startup_warnings_common',
diff --git a/src/mongo/db/commands/apply_ops_cmd.cpp b/src/mongo/db/commands/apply_ops_cmd.cpp
index 976a85bcec8..34010f2aa3f 100644
--- a/src/mongo/db/commands/apply_ops_cmd.cpp
+++ b/src/mongo/db/commands/apply_ops_cmd.cpp
@@ -50,6 +50,7 @@
#include "mongo/db/repl/apply_ops.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/service_context.h"
#include "mongo/util/log.h"
#include "mongo/util/scopeguard.h"
diff --git a/src/mongo/db/commands/collection_to_capped.cpp b/src/mongo/db/commands/collection_to_capped.cpp
index 07da52d1bca..d804b9230f5 100644
--- a/src/mongo/db/commands/collection_to_capped.cpp
+++ b/src/mongo/db/commands/collection_to_capped.cpp
@@ -40,7 +40,7 @@
#include "mongo/db/op_observer.h"
#include "mongo/db/query/find.h"
#include "mongo/db/query/internal_plans.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/service_context.h"
namespace mongo {
diff --git a/src/mongo/db/commands/compact.cpp b/src/mongo/db/commands/compact.cpp
index 83ddab63ce1..3b89886e3fd 100644
--- a/src/mongo/db/commands/compact.cpp
+++ b/src/mongo/db/commands/compact.cpp
@@ -45,7 +45,7 @@
#include "mongo/db/db_raii.h"
#include "mongo/db/index_builder.h"
#include "mongo/db/jsobj.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/commands/conn_pool_stats.cpp b/src/mongo/db/commands/conn_pool_stats.cpp
index f554b55302a..cfa8def3f02 100644
--- a/src/mongo/db/commands/conn_pool_stats.cpp
+++ b/src/mongo/db/commands/conn_pool_stats.cpp
@@ -36,6 +36,7 @@
#include "mongo/client/global_conn_pool.h"
#include "mongo/db/commands.h"
#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/executor/connection_pool_stats.h"
#include "mongo/executor/network_interface_factory.h"
#include "mongo/executor/task_executor_pool.h"
diff --git a/src/mongo/db/commands/count_cmd.cpp b/src/mongo/db/commands/count_cmd.cpp
index d2e35f86fd6..306c339f41a 100644
--- a/src/mongo/db/commands/count_cmd.cpp
+++ b/src/mongo/db/commands/count_cmd.cpp
@@ -41,7 +41,7 @@
#include "mongo/db/query/get_executor.h"
#include "mongo/db/query/plan_summary_stats.h"
#include "mongo/db/query/view_response_formatter.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/views/resolved_view.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/commands/create_indexes.cpp b/src/mongo/db/commands/create_indexes.cpp
index 535f1b11704..1a7e8f80681 100644
--- a/src/mongo/db/commands/create_indexes.cpp
+++ b/src/mongo/db/commands/create_indexes.cpp
@@ -48,7 +48,7 @@
#include "mongo/db/ops/insert.h"
#include "mongo/db/query/collation/collator_factory_interface.h"
#include "mongo/db/repl/repl_client_info.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/s/collection_metadata.h"
#include "mongo/db/s/collection_sharding_state.h"
#include "mongo/db/server_options.h"
diff --git a/src/mongo/db/commands/dbcommands.cpp b/src/mongo/db/commands/dbcommands.cpp
index ce56e6a61b0..d1a927ec9ee 100644
--- a/src/mongo/db/commands/dbcommands.cpp
+++ b/src/mongo/db/commands/dbcommands.cpp
@@ -83,7 +83,7 @@
#include "mongo/db/repl/read_concern_args.h"
#include "mongo/db/repl/repl_client_info.h"
#include "mongo/db/repl/repl_settings.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/server_parameters.h"
#include "mongo/db/stats/storage_stats.h"
#include "mongo/db/write_concern.h"
diff --git a/src/mongo/db/commands/do_txn_cmd.cpp b/src/mongo/db/commands/do_txn_cmd.cpp
index 9d87249fa6e..2b0200c6d17 100644
--- a/src/mongo/db/commands/do_txn_cmd.cpp
+++ b/src/mongo/db/commands/do_txn_cmd.cpp
@@ -51,6 +51,7 @@
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/oplog_entry_gen.h"
#include "mongo/db/repl/repl_client_info.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/service_context.h"
#include "mongo/util/log.h"
#include "mongo/util/scopeguard.h"
diff --git a/src/mongo/db/commands/drop_indexes.cpp b/src/mongo/db/commands/drop_indexes.cpp
index 48b70d171f9..2c97f3341bc 100644
--- a/src/mongo/db/commands/drop_indexes.cpp
+++ b/src/mongo/db/commands/drop_indexes.cpp
@@ -52,7 +52,7 @@
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/index_builder.h"
#include "mongo/db/op_observer.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/service_context.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/commands/explain_cmd.cpp b/src/mongo/db/commands/explain_cmd.cpp
index 8f0ce39a66a..89d43bddd48 100644
--- a/src/mongo/db/commands/explain_cmd.cpp
+++ b/src/mongo/db/commands/explain_cmd.cpp
@@ -31,6 +31,7 @@
#include "mongo/db/command_can_run_here.h"
#include "mongo/db/commands.h"
#include "mongo/db/query/explain.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/util/mongoutils/str.h"
namespace mongo {
diff --git a/src/mongo/db/commands/find_and_modify.cpp b/src/mongo/db/commands/find_and_modify.cpp
index e836e7aa737..8fdbb86a019 100644
--- a/src/mongo/db/commands/find_and_modify.cpp
+++ b/src/mongo/db/commands/find_and_modify.cpp
@@ -61,7 +61,7 @@
#include "mongo/db/query/plan_executor.h"
#include "mongo/db/query/plan_summary_stats.h"
#include "mongo/db/repl/repl_client_info.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/retryable_writes_stats.h"
#include "mongo/db/s/collection_sharding_state.h"
#include "mongo/db/session_catalog.h"
diff --git a/src/mongo/db/commands/get_last_error.cpp b/src/mongo/db/commands/get_last_error.cpp
index c7673052e8b..1957901b12b 100644
--- a/src/mongo/db/commands/get_last_error.cpp
+++ b/src/mongo/db/commands/get_last_error.cpp
@@ -39,7 +39,7 @@
#include "mongo/db/lasterror.h"
#include "mongo/db/repl/bson_extract_optime.h"
#include "mongo/db/repl/repl_client_info.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/write_concern.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/commands/getmore_cmd.cpp b/src/mongo/db/commands/getmore_cmd.cpp
index 2776b6f607b..3d000219e41 100644
--- a/src/mongo/db/commands/getmore_cmd.cpp
+++ b/src/mongo/db/commands/getmore_cmd.cpp
@@ -50,7 +50,7 @@
#include "mongo/db/query/plan_executor.h"
#include "mongo/db/query/plan_summary_stats.h"
#include "mongo/db/repl/oplog.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/service_context.h"
#include "mongo/db/stats/counters.h"
#include "mongo/db/stats/top.h"
diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp
index d323bdd707c..c4a2ce98128 100644
--- a/src/mongo/db/commands/mr.cpp
+++ b/src/mongo/db/commands/mr.cpp
@@ -59,7 +59,7 @@
#include "mongo/db/query/get_executor.h"
#include "mongo/db/query/plan_summary_stats.h"
#include "mongo/db/query/query_planner.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/s/collection_metadata.h"
#include "mongo/db/s/collection_sharding_state.h"
#include "mongo/db/s/sharding_state.h"
diff --git a/src/mongo/db/commands/oplog_note.cpp b/src/mongo/db/commands/oplog_note.cpp
index 852a25b411a..0cc7afac12b 100644
--- a/src/mongo/db/commands/oplog_note.cpp
+++ b/src/mongo/db/commands/oplog_note.cpp
@@ -46,6 +46,7 @@
#include "mongo/db/operation_context.h"
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/service_context.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/commands/rename_collection_cmd.cpp b/src/mongo/db/commands/rename_collection_cmd.cpp
index 3f05d9cd2b9..62764fe5cb4 100644
--- a/src/mongo/db/commands/rename_collection_cmd.cpp
+++ b/src/mongo/db/commands/rename_collection_cmd.cpp
@@ -44,7 +44,7 @@
#include "mongo/db/namespace_string.h"
#include "mongo/db/op_observer.h"
#include "mongo/db/ops/insert.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/service_context.h"
#include "mongo/util/scopeguard.h"
diff --git a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp
index 4473b35e010..5eb5867d5b8 100644
--- a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp
+++ b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp
@@ -39,6 +39,8 @@
#include "mongo/db/concurrency/d_concurrency.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/repl/repl_client_info.h"
+#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/db/server_options.h"
#include "mongo/rpc/get_status_from_command_result.h"
diff --git a/src/mongo/db/commands/test_commands.cpp b/src/mongo/db/commands/test_commands.cpp
index 6ffca594ad4..fc3f8c467d7 100644
--- a/src/mongo/db/commands/test_commands.cpp
+++ b/src/mongo/db/commands/test_commands.cpp
@@ -44,6 +44,7 @@
#include "mongo/db/index_builder.h"
#include "mongo/db/op_observer.h"
#include "mongo/db/query/internal_plans.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/service_context.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/commands/write_commands/write_commands.cpp b/src/mongo/db/commands/write_commands/write_commands.cpp
index 54410f26c0e..a781b2682ed 100644
--- a/src/mongo/db/commands/write_commands/write_commands.cpp
+++ b/src/mongo/db/commands/write_commands/write_commands.cpp
@@ -46,7 +46,7 @@
#include "mongo/db/query/explain.h"
#include "mongo/db/query/get_executor.h"
#include "mongo/db/repl/repl_client_info.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/server_parameters.h"
#include "mongo/db/stats/counters.h"
#include "mongo/db/write_concern.h"
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index 8e27f6a2c26..24a7ef71828 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -99,8 +99,8 @@
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/repl_settings.h"
#include "mongo/db/repl/replication_consistency_markers_impl.h"
-#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/db/repl/replication_coordinator_external_state_impl.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/repl/replication_coordinator_impl.h"
#include "mongo/db/repl/replication_process.h"
#include "mongo/db/repl/replication_recovery.h"
diff --git a/src/mongo/db/exec/delete.cpp b/src/mongo/db/exec/delete.cpp
index 47563136c9c..57820ea7a27 100644
--- a/src/mongo/db/exec/delete.cpp
+++ b/src/mongo/db/exec/delete.cpp
@@ -40,7 +40,7 @@
#include "mongo/db/exec/write_stage_common.h"
#include "mongo/db/op_observer.h"
#include "mongo/db/query/canonical_query.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/service_context.h"
#include "mongo/stdx/memory.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/exec/update.cpp b/src/mongo/db/exec/update.cpp
index 44e4513440a..0a214d97bd9 100644
--- a/src/mongo/db/exec/update.cpp
+++ b/src/mongo/db/exec/update.cpp
@@ -43,7 +43,7 @@
#include "mongo/db/op_observer.h"
#include "mongo/db/ops/update_lifecycle.h"
#include "mongo/db/query/explain.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/s/collection_metadata.h"
#include "mongo/db/s/collection_sharding_state.h"
#include "mongo/db/s/metadata_manager.h"
diff --git a/src/mongo/db/ftdc/SConscript b/src/mongo/db/ftdc/SConscript
index 68ff033a2d2..5e78036c3e5 100644
--- a/src/mongo/db/ftdc/SConscript
+++ b/src/mongo/db/ftdc/SConscript
@@ -64,7 +64,7 @@ env.Library(
'ftdc_mongod.cpp',
],
LIBDEPS=[
- '$BUILD_DIR/mongo/db/repl/repl_coordinator_interface',
+ '$BUILD_DIR/mongo/db/repl/repl_coordinator_global',
'$BUILD_DIR/mongo/db/storage/storage_options',
'ftdc_server'
],
diff --git a/src/mongo/db/ftdc/ftdc_mongod.cpp b/src/mongo/db/ftdc/ftdc_mongod.cpp
index d3c1c703dbd..1f53ec345ea 100644
--- a/src/mongo/db/ftdc/ftdc_mongod.cpp
+++ b/src/mongo/db/ftdc/ftdc_mongod.cpp
@@ -36,6 +36,7 @@
#include "mongo/db/ftdc/controller.h"
#include "mongo/db/ftdc/ftdc_server.h"
#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/storage/storage_options.h"
namespace mongo {
@@ -43,7 +44,7 @@ namespace mongo {
namespace {
void registerMongoDCollectors(FTDCController* controller) {
// These metrics are only collected if replication is enabled
- if (repl::ReplicationCoordinator::get(getGlobalServiceContext())->getReplicationMode() !=
+ if (repl::getGlobalReplicationCoordinator()->getReplicationMode() !=
repl::ReplicationCoordinator::modeNone) {
// CmdReplSetGetStatus
controller->addPeriodicCollector(stdx::make_unique<FTDCSimpleInternalCommandCollector>(
diff --git a/src/mongo/db/log_process_details.cpp b/src/mongo/db/log_process_details.cpp
index d12b0ebce29..681db42d7e1 100644
--- a/src/mongo/db/log_process_details.cpp
+++ b/src/mongo/db/log_process_details.cpp
@@ -36,6 +36,7 @@
#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/server_options.h"
#include "mongo/db/server_options_helpers.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/ops/parsed_delete.cpp b/src/mongo/db/ops/parsed_delete.cpp
index a213d038ad9..839381e358f 100644
--- a/src/mongo/db/ops/parsed_delete.cpp
+++ b/src/mongo/db/ops/parsed_delete.cpp
@@ -40,6 +40,7 @@
#include "mongo/db/query/canonical_query.h"
#include "mongo/db/query/get_executor.h"
#include "mongo/db/query/query_planner_common.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/util/assert_util.h"
#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
diff --git a/src/mongo/db/ops/update.cpp b/src/mongo/db/ops/update.cpp
index ba573531791..8bc1344c0e0 100644
--- a/src/mongo/db/ops/update.cpp
+++ b/src/mongo/db/ops/update.cpp
@@ -49,7 +49,7 @@
#include "mongo/db/query/get_executor.h"
#include "mongo/db/query/plan_summary_stats.h"
#include "mongo/db/repl/repl_client_info.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/update/update_driver.h"
#include "mongo/db/update_index_data.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/prefetch.cpp b/src/mongo/db/prefetch.cpp
index a55993037bc..615721b5e31 100644
--- a/src/mongo/db/prefetch.cpp
+++ b/src/mongo/db/prefetch.cpp
@@ -43,6 +43,7 @@
#include "mongo/db/repl/oplog_entry.h"
#include "mongo/db/repl/repl_settings.h"
#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/server_parameters.h"
#include "mongo/db/stats/timer_stats.h"
#include "mongo/db/storage/mmap_v1/mmap.h"
@@ -215,12 +216,12 @@ public:
virtual ~ReplIndexPrefetch() {}
const char* _value() {
- if (ReplicationCoordinator::get(getGlobalServiceContext())->getReplicationMode() !=
+ if (getGlobalReplicationCoordinator()->getReplicationMode() !=
ReplicationCoordinator::modeReplSet) {
return "uninitialized";
}
ReplSettings::IndexPrefetchConfig ip =
- ReplicationCoordinator::get(getGlobalServiceContext())->getIndexPrefetchConfig();
+ getGlobalReplicationCoordinator()->getIndexPrefetchConfig();
switch (ip) {
case ReplSettings::IndexPrefetchConfig::PREFETCH_NONE:
return "none";
@@ -238,7 +239,7 @@ public:
}
virtual Status set(const BSONElement& newValueElement) {
- if (ReplicationCoordinator::get(getGlobalServiceContext())->getReplicationMode() !=
+ if (getGlobalReplicationCoordinator()->getReplicationMode() !=
ReplicationCoordinator::modeReplSet) {
return Status(ErrorCodes::BadValue, "replication is not enabled");
}
@@ -263,8 +264,7 @@ public:
str::stream() << "unrecognized indexPrefetch setting: " << prefetch);
}
- ReplicationCoordinator::get(getGlobalServiceContext())
- ->setIndexPrefetchConfig(prefetchConfig);
+ getGlobalReplicationCoordinator()->setIndexPrefetchConfig(prefetchConfig);
return Status::OK();
}
diff --git a/src/mongo/db/query/get_executor.cpp b/src/mongo/db/query/get_executor.cpp
index 111d2884174..99d7db885a4 100644
--- a/src/mongo/db/query/get_executor.cpp
+++ b/src/mongo/db/query/get_executor.cpp
@@ -73,7 +73,7 @@
#include "mongo/db/query/query_settings.h"
#include "mongo/db/query/stage_builder.h"
#include "mongo/db/repl/optime.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/s/collection_metadata.h"
#include "mongo/db/s/collection_sharding_state.h"
#include "mongo/db/s/sharding_state.h"
diff --git a/src/mongo/db/repair_database_and_check_version.cpp b/src/mongo/db/repair_database_and_check_version.cpp
index 87a486b0122..43d3017cf5b 100644
--- a/src/mongo/db/repair_database_and_check_version.cpp
+++ b/src/mongo/db/repair_database_and_check_version.cpp
@@ -44,7 +44,7 @@
#include "mongo/db/query/internal_plans.h"
#include "mongo/db/repair_database.h"
#include "mongo/db/repl/drop_pending_collection_reaper.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/server_options.h"
#include "mongo/db/storage/mmap_v1/mmap_v1_options.h"
#include "mongo/util/log.h"
@@ -225,9 +225,7 @@ void checkForIdIndexesAndDropPendingCollections(OperationContext* opCtx, Databas
unsigned long long checkIfReplMissingFromCommandLine(OperationContext* opCtx) {
// This is helpful for the query below to work as you can't open files when readlocked
Lock::GlobalWrite lk(opCtx);
- if (!repl::ReplicationCoordinator::get(getGlobalServiceContext())
- ->getSettings()
- .usingReplSets()) {
+ if (!repl::getGlobalReplicationCoordinator()->getSettings().usingReplSets()) {
DBDirectClient c(opCtx);
return c.count(kSystemReplSetCollection.ns());
}
diff --git a/src/mongo/db/repl/SConscript b/src/mongo/db/repl/SConscript
index 0f13e84726f..670f315d71e 100644
--- a/src/mongo/db/repl/SConscript
+++ b/src/mongo/db/repl/SConscript
@@ -98,6 +98,7 @@ env.Library(
'oplog_interface_remote',
'oplogreader',
'repl_coordinator_interface',
+ 'repl_coordinator_global',
'$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/db/background',
'$BUILD_DIR/mongo/db/catalog/database',
@@ -142,6 +143,7 @@ env.Library(
'$BUILD_DIR/mongo/executor/network_interface_factory',
'$BUILD_DIR/mongo/executor/task_executor_interface',
'$BUILD_DIR/mongo/executor/thread_pool_task_executor',
+ '$BUILD_DIR/mongo/db/repl/repl_coordinator_global',
'$BUILD_DIR/mongo/util/concurrency/thread_pool',
],
)
@@ -287,7 +289,7 @@ env.Library(
'$BUILD_DIR/mongo/db/server_options',
'$BUILD_DIR/mongo/db/storage/storage_options',
'optime',
- 'repl_coordinator_interface',
+ 'repl_coordinator_global',
'replication_consistency_markers_idl',
],
)
@@ -631,7 +633,7 @@ env.Library(
'$BUILD_DIR/mongo/util/net/network',
'initial_syncer',
'oplog_entry',
- 'repl_coordinator_interface',
+ 'repl_coordinator_global',
'storage_interface',
'bgsync',
],
@@ -794,6 +796,7 @@ env.Library(
'collection_cloner',
'initial_syncer',
'data_replicator_external_state_initial_sync',
+ 'repl_coordinator_global',
'repl_coordinator_interface',
'repl_settings',
'replica_set_messages',
@@ -955,6 +958,10 @@ env.Library(
],
)
+env.Library('repl_coordinator_global',
+ 'replication_coordinator_global.cpp',
+ LIBDEPS=['repl_coordinator_interface'])
+
env.Library(
target='replmocks',
source=[
@@ -1061,7 +1068,7 @@ env.Library(
'$BUILD_DIR/mongo/db/concurrency/lock_manager',
'$BUILD_DIR/mongo/db/dbhelpers',
'$BUILD_DIR/mongo/db/lasterror',
- '$BUILD_DIR/mongo/db/repl/repl_coordinator_interface',
+ '$BUILD_DIR/mongo/db/repl/repl_coordinator_global',
'$BUILD_DIR/mongo/db/storage/storage_options',
'drop_pending_collection_reaper',
'repl_settings',
@@ -1570,7 +1577,7 @@ env.Library(
'oplog_buffer_collection',
'oplog_interface_remote',
'optime',
- 'repl_coordinator_interface',
+ 'repl_coordinator_global',
'repl_settings',
'replication_consistency_markers_impl',
'replication_info',
diff --git a/src/mongo/db/repl/apply_ops.cpp b/src/mongo/db/repl/apply_ops.cpp
index 2d85fe4c908..42e857b0e74 100644
--- a/src/mongo/db/repl/apply_ops.cpp
+++ b/src/mongo/db/repl/apply_ops.cpp
@@ -48,7 +48,7 @@
#include "mongo/db/op_observer.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/query/collation/collation_spec.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/service_context.h"
#include "mongo/rpc/get_status_from_command_result.h"
#include "mongo/util/fail_point_service.h"
diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp
index 2a3248e257c..dd56f8a3856 100644
--- a/src/mongo/db/repl/bgsync.cpp
+++ b/src/mongo/db/repl/bgsync.cpp
@@ -45,7 +45,7 @@
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/oplog_interface_local.h"
#include "mongo/db/repl/oplog_interface_remote.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/repl/replication_coordinator_impl.h"
#include "mongo/db/repl/replication_process.h"
#include "mongo/db/repl/rollback_source_impl.h"
diff --git a/src/mongo/db/repl/do_txn.cpp b/src/mongo/db/repl/do_txn.cpp
index 42258b4eb7e..777f8ccabcc 100644
--- a/src/mongo/db/repl/do_txn.cpp
+++ b/src/mongo/db/repl/do_txn.cpp
@@ -48,7 +48,7 @@
#include "mongo/db/op_observer.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/query/collation/collation_spec.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/service_context.h"
#include "mongo/db/session_catalog.h"
#include "mongo/rpc/get_status_from_command_result.h"
diff --git a/src/mongo/db/repl/idempotency_test_fixture.cpp b/src/mongo/db/repl/idempotency_test_fixture.cpp
index 8dc9b4823e5..32b7347380c 100644
--- a/src/mongo/db/repl/idempotency_test_fixture.cpp
+++ b/src/mongo/db/repl/idempotency_test_fixture.cpp
@@ -52,6 +52,7 @@
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/oplog_interface_local.h"
#include "mongo/db/repl/replication_consistency_markers_mock.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/repl/replication_coordinator_mock.h"
#include "mongo/db/repl/storage_interface.h"
#include "mongo/util/md5.hpp"
diff --git a/src/mongo/db/repl/master_slave.cpp b/src/mongo/db/repl/master_slave.cpp
index 2582c03efb1..e458e63c6d4 100644
--- a/src/mongo/db/repl/master_slave.cpp
+++ b/src/mongo/db/repl/master_slave.cpp
@@ -64,7 +64,7 @@
#include "mongo/db/repl/handshake_args.h"
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/repl_client_info.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/repl/sync_tail.h"
#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
@@ -854,8 +854,7 @@ public:
return Status(ErrorCodes::BadValue, "replApplyBatchSize has to be >= 1 and <= 1024");
}
- const ReplSettings& replSettings =
- ReplicationCoordinator::get(getGlobalServiceContext())->getSettings();
+ const ReplSettings& replSettings = getGlobalReplicationCoordinator()->getSettings();
if (replSettings.getSlaveDelaySecs() != Seconds(0) && potentialNewValue > 1) {
return Status(ErrorCodes::BadValue, "can't use a batch size > 1 with slavedelay");
}
diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp
index 6eab8fc2f4a..62e2512564f 100644
--- a/src/mongo/db/repl/oplog.cpp
+++ b/src/mongo/db/repl/oplog.cpp
@@ -78,7 +78,7 @@
#include "mongo/db/repl/oplogreader.h"
#include "mongo/db/repl/optime.h"
#include "mongo/db/repl/repl_client_info.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/repl/sync_tail.h"
#include "mongo/db/repl/timestamp_block.h"
#include "mongo/db/server_parameters.h"
diff --git a/src/mongo/db/repl/repl_set_commands.cpp b/src/mongo/db/repl/repl_set_commands.cpp
index 5394982deba..1aa71ccfca7 100644
--- a/src/mongo/db/repl/repl_set_commands.cpp
+++ b/src/mongo/db/repl/repl_set_commands.cpp
@@ -53,8 +53,9 @@
#include "mongo/db/repl/repl_set_heartbeat_args.h"
#include "mongo/db/repl/repl_set_heartbeat_args_v1.h"
#include "mongo/db/repl/repl_set_heartbeat_response.h"
-#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/db/repl/replication_coordinator_external_state_impl.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/repl/replication_process.h"
#include "mongo/db/repl/storage_interface.h"
#include "mongo/db/repl/update_position_args.h"
@@ -78,7 +79,7 @@ class ReplExecutorSSM : public ServerStatusMetric {
public:
ReplExecutorSSM() : ServerStatusMetric("repl.executor") {}
virtual void appendAtLeaf(BSONObjBuilder& b) const {
- ReplicationCoordinator::get(getGlobalServiceContext())->appendDiagnosticBSON(&b);
+ getGlobalReplicationCoordinator()->appendDiagnosticBSON(&b);
}
} replExecutorSSM;
diff --git a/src/mongo/db/repl/repl_set_request_votes.cpp b/src/mongo/db/repl/repl_set_request_votes.cpp
index b917a06ed09..1ceda277eb7 100644
--- a/src/mongo/db/repl/repl_set_request_votes.cpp
+++ b/src/mongo/db/repl/repl_set_request_votes.cpp
@@ -33,7 +33,7 @@
#include "mongo/db/repl/optime.h"
#include "mongo/db/repl/repl_set_command.h"
#include "mongo/db/repl/repl_set_request_votes_args.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/executor/network_interface.h"
#include "mongo/transport/session.h"
#include "mongo/transport/transport_layer.h"
diff --git a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
index 2a46e8eef72..6f86ecc17b8 100644
--- a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
@@ -65,7 +65,7 @@
#include "mongo/db/repl/oplog_buffer_collection.h"
#include "mongo/db/repl/oplog_buffer_proxy.h"
#include "mongo/db/repl/repl_settings.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/repl/replication_process.h"
#include "mongo/db/repl/rs_sync.h"
#include "mongo/db/repl/storage_interface.h"
diff --git a/src/mongo/db/repl/replication_coordinator_global.cpp b/src/mongo/db/repl/replication_coordinator_global.cpp
new file mode 100644
index 00000000000..81fde5a046a
--- /dev/null
+++ b/src/mongo/db/repl/replication_coordinator_global.cpp
@@ -0,0 +1,48 @@
+/**
+ * Copyright (C) 2014 MongoDB Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the GNU Affero General Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#include "mongo/platform/basic.h"
+
+#include "mongo/db/repl/replication_coordinator_global.h"
+#include "mongo/db/service_context.h"
+
+namespace mongo {
+namespace repl {
+
+ReplicationCoordinator* getGlobalReplicationCoordinator() {
+ ReplicationCoordinator* globalReplCoordinator =
+ ReplicationCoordinator::get(getGlobalServiceContext());
+ return globalReplCoordinator;
+}
+
+void setGlobalReplicationCoordinator(ReplicationCoordinator* coord) {
+ repl::ReplicationCoordinator::set(getGlobalServiceContext(),
+ std::unique_ptr<ReplicationCoordinator>(coord));
+}
+} // namespace repl
+} // namespace mongo
diff --git a/src/mongo/db/repl/replication_coordinator_global.h b/src/mongo/db/repl/replication_coordinator_global.h
new file mode 100644
index 00000000000..a18033fd162
--- /dev/null
+++ b/src/mongo/db/repl/replication_coordinator_global.h
@@ -0,0 +1,40 @@
+/**
+ * Copyright (C) 2014 MongoDB Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the GNU Affero General Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#pragma once
+
+#include "mongo/db/repl/replication_coordinator.h"
+
+namespace mongo {
+namespace repl {
+
+ReplicationCoordinator* getGlobalReplicationCoordinator();
+void setGlobalReplicationCoordinator(ReplicationCoordinator* coordinator);
+
+} // namespace repl
+} // namespace mongo
diff --git a/src/mongo/db/repl/replication_info.cpp b/src/mongo/db/repl/replication_info.cpp
index 396c41ff260..199190c5610 100644
--- a/src/mongo/db/repl/replication_info.cpp
+++ b/src/mongo/db/repl/replication_info.cpp
@@ -49,7 +49,7 @@
#include "mongo/db/repl/master_slave.h"
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/oplogreader.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/repl/replication_process.h"
#include "mongo/db/repl/storage_interface.h"
#include "mongo/db/server_parameters.h"
diff --git a/src/mongo/db/repl/resync.cpp b/src/mongo/db/repl/resync.cpp
index 4141485cb93..cff397f8589 100644
--- a/src/mongo/db/repl/resync.cpp
+++ b/src/mongo/db/repl/resync.cpp
@@ -30,7 +30,7 @@
#include "mongo/db/concurrency/d_concurrency.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/repl/master_slave.h" // replSettings
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
namespace mongo {
diff --git a/src/mongo/db/repl/storage_interface_impl.cpp b/src/mongo/db/repl/storage_interface_impl.cpp
index 7d127709294..10b4684ba64 100644
--- a/src/mongo/db/repl/storage_interface_impl.cpp
+++ b/src/mongo/db/repl/storage_interface_impl.cpp
@@ -71,6 +71,7 @@
#include "mongo/db/repl/collection_bulk_loader_impl.h"
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/repl/rollback_gen.h"
#include "mongo/db/service_context.h"
#include "mongo/util/assert_util.h"
diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp
index a871cfb79e8..0f715f1ce60 100644
--- a/src/mongo/db/repl/sync_tail.cpp
+++ b/src/mongo/db/repl/sync_tail.cpp
@@ -66,6 +66,7 @@
#include "mongo/db/repl/repl_client_info.h"
#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/repl/replication_process.h"
#include "mongo/db/repl/storage_interface.h"
#include "mongo/db/server_parameters.h"
diff --git a/src/mongo/db/repl/sync_tail_test.cpp b/src/mongo/db/repl/sync_tail_test.cpp
index 8007c8e67a3..bf818d354e4 100644
--- a/src/mongo/db/repl/sync_tail_test.cpp
+++ b/src/mongo/db/repl/sync_tail_test.cpp
@@ -55,7 +55,7 @@
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/oplog_interface_local.h"
#include "mongo/db/repl/replication_consistency_markers_mock.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/repl/replication_coordinator_mock.h"
#include "mongo/db/repl/replication_process.h"
#include "mongo/db/repl/storage_interface.h"
@@ -1613,8 +1613,7 @@ TEST_F(IdempotencyTest, CreateCollectionWithValidation) {
}
TEST_F(IdempotencyTest, CreateCollectionWithCollation) {
- ASSERT_OK(ReplicationCoordinator::get(getGlobalServiceContext())
- ->setFollowerMode(MemberState::RS_RECOVERING));
+ ASSERT_OK(getGlobalReplicationCoordinator()->setFollowerMode(MemberState::RS_RECOVERING));
ASSERT_OK(runOpInitialSync(createCollection()));
CollectionUUID uuid = UUID::gen();
@@ -1660,8 +1659,7 @@ TEST_F(IdempotencyTest, CreateCollectionWithCollation) {
}
TEST_F(IdempotencyTest, CreateCollectionWithIdIndex) {
- ASSERT_OK(ReplicationCoordinator::get(getGlobalServiceContext())
- ->setFollowerMode(MemberState::RS_RECOVERING));
+ ASSERT_OK(getGlobalReplicationCoordinator()->setFollowerMode(MemberState::RS_RECOVERING));
CollectionUUID uuid = UUID::gen();
auto options1 = BSON("idIndex" << BSON("key" << fromjson("{_id: 1}") << "name"
@@ -1693,8 +1691,7 @@ TEST_F(IdempotencyTest, CreateCollectionWithIdIndex) {
}
TEST_F(IdempotencyTest, CreateCollectionWithView) {
- ASSERT_OK(ReplicationCoordinator::get(getGlobalServiceContext())
- ->setFollowerMode(MemberState::RS_RECOVERING));
+ ASSERT_OK(getGlobalReplicationCoordinator()->setFollowerMode(MemberState::RS_RECOVERING));
CollectionOptions options;
options.uuid = UUID::gen();
@@ -1716,8 +1713,7 @@ TEST_F(IdempotencyTest, CreateCollectionWithView) {
}
TEST_F(IdempotencyTest, CollModNamespaceNotFound) {
- ASSERT_OK(ReplicationCoordinator::get(getGlobalServiceContext())
- ->setFollowerMode(MemberState::RS_RECOVERING));
+ ASSERT_OK(getGlobalReplicationCoordinator()->setFollowerMode(MemberState::RS_RECOVERING));
ASSERT_OK(runOpInitialSync(createCollection()));
ASSERT_OK(
@@ -1733,8 +1729,7 @@ TEST_F(IdempotencyTest, CollModNamespaceNotFound) {
}
TEST_F(IdempotencyTest, CollModIndexNotFound) {
- ASSERT_OK(ReplicationCoordinator::get(getGlobalServiceContext())
- ->setFollowerMode(MemberState::RS_RECOVERING));
+ ASSERT_OK(getGlobalReplicationCoordinator()->setFollowerMode(MemberState::RS_RECOVERING));
ASSERT_OK(runOpInitialSync(createCollection()));
ASSERT_OK(
diff --git a/src/mongo/db/s/SConscript b/src/mongo/db/s/SConscript
index cda73aa0065..b894268d9a6 100644
--- a/src/mongo/db/s/SConscript
+++ b/src/mongo/db/s/SConscript
@@ -230,7 +230,7 @@ env.Library(
'$BUILD_DIR/mongo/db/commands/dcommands_fcv',
'$BUILD_DIR/mongo/db/commands/server_status',
'$BUILD_DIR/mongo/db/index_d',
- '$BUILD_DIR/mongo/db/repl/repl_coordinator_interface',
+ '$BUILD_DIR/mongo/db/repl/repl_coordinator_global',
'$BUILD_DIR/mongo/s/commands/shared_cluster_commands',
'balancer',
'sharding_catalog_manager',
diff --git a/src/mongo/db/s/chunk_move_write_concern_options.cpp b/src/mongo/db/s/chunk_move_write_concern_options.cpp
index 7cccc644789..2f2d7452b7b 100644
--- a/src/mongo/db/s/chunk_move_write_concern_options.cpp
+++ b/src/mongo/db/s/chunk_move_write_concern_options.cpp
@@ -34,7 +34,7 @@
#include "mongo/base/status_with.h"
#include "mongo/db/operation_context.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/service_context.h"
#include "mongo/s/request_types/migration_secondary_throttle_options.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/s/sharding_egress_metadata_hook_for_mongod.cpp b/src/mongo/db/s/sharding_egress_metadata_hook_for_mongod.cpp
index 5c0cab7d560..b87497437bf 100644
--- a/src/mongo/db/s/sharding_egress_metadata_hook_for_mongod.cpp
+++ b/src/mongo/db/s/sharding_egress_metadata_hook_for_mongod.cpp
@@ -33,7 +33,7 @@
#include "mongo/db/s/sharding_egress_metadata_hook_for_mongod.h"
#include "mongo/base/status.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/server_options.h"
#include "mongo/s/grid.h"
diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp
index f724a8a561d..bf482e3a8b8 100644
--- a/src/mongo/db/service_entry_point_common.cpp
+++ b/src/mongo/db/service_entry_point_common.cpp
@@ -60,7 +60,7 @@
#include "mongo/db/repl/optime.h"
#include "mongo/db/repl/read_concern_args.h"
#include "mongo/db/repl/repl_client_info.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/s/operation_sharding_state.h"
#include "mongo/db/s/shard_filtering_metadata_refresh.h"
#include "mongo/db/s/sharded_connection_info.h"
diff --git a/src/mongo/db/storage/ephemeral_for_test/SConscript b/src/mongo/db/storage/ephemeral_for_test/SConscript
index fdcf89ba82a..f96900c9375 100644
--- a/src/mongo/db/storage/ephemeral_for_test/SConscript
+++ b/src/mongo/db/storage/ephemeral_for_test/SConscript
@@ -28,7 +28,7 @@ env.Library(
'$BUILD_DIR/mongo/db/namespace_string',
'$BUILD_DIR/mongo/db/catalog/collection_options',
'$BUILD_DIR/mongo/db/index/index_descriptor',
- '$BUILD_DIR/mongo/db/repl/repl_coordinator_interface',
+ '$BUILD_DIR/mongo/db/repl/repl_coordinator_global',
'$BUILD_DIR/mongo/db/storage/index_entry_comparison',
'$BUILD_DIR/mongo/db/storage/journal_listener',
'$BUILD_DIR/mongo/db/storage/kv/kv_prefix',
diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_recovery_unit.cpp b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_recovery_unit.cpp
index 800b6b6f1cc..288cdc7ee5e 100644
--- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_recovery_unit.cpp
+++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_recovery_unit.cpp
@@ -32,6 +32,7 @@
#include "mongo/db/storage/ephemeral_for_test/ephemeral_for_test_recovery_unit.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/storage/sorted_data_interface.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/storage/kv/kv_storage_engine_test.cpp b/src/mongo/db/storage/kv/kv_storage_engine_test.cpp
index 4330a4906fa..7e0b0bfec7a 100644
--- a/src/mongo/db/storage/kv/kv_storage_engine_test.cpp
+++ b/src/mongo/db/storage/kv/kv_storage_engine_test.cpp
@@ -37,6 +37,7 @@
#include "mongo/db/operation_context_noop.h"
#include "mongo/db/repair_database.h"
#include "mongo/db/repl/repl_settings.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/repl/replication_coordinator_mock.h"
#include "mongo/db/service_context_d_test_fixture.h"
#include "mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine.h"
@@ -178,10 +179,8 @@ TEST_F(KVStorageEngineTest, ReconcileIdentsTest) {
}
TEST_F(KVStorageEngineTest, RecreateIndexes) {
- repl::ReplicationCoordinator::set(
- getGlobalServiceContext(),
- std::unique_ptr<repl::ReplicationCoordinator>(
- new repl::ReplicationCoordinatorMock(getGlobalServiceContext(), repl::ReplSettings())));
+ repl::setGlobalReplicationCoordinator(
+ new repl::ReplicationCoordinatorMock(getGlobalServiceContext(), repl::ReplSettings()));
auto opCtx = cc().makeOperationContext();
diff --git a/src/mongo/db/ttl.cpp b/src/mongo/db/ttl.cpp
index fd08ff8a7d3..da37aecd0cb 100644
--- a/src/mongo/db/ttl.cpp
+++ b/src/mongo/db/ttl.cpp
@@ -52,7 +52,7 @@
#include "mongo/db/namespace_string.h"
#include "mongo/db/ops/insert.h"
#include "mongo/db/query/internal_plans.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/server_parameters.h"
#include "mongo/db/ttl_collection_cache.h"
#include "mongo/util/background.h"
diff --git a/src/mongo/db/views/view_sharding_check.cpp b/src/mongo/db/views/view_sharding_check.cpp
index 9f6301dda12..9f14452bbd6 100644
--- a/src/mongo/db/views/view_sharding_check.cpp
+++ b/src/mongo/db/views/view_sharding_check.cpp
@@ -34,7 +34,7 @@
#include "mongo/db/commands.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/operation_context.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/s/collection_sharding_state.h"
#include "mongo/db/s/sharding_state.h"
#include "mongo/db/server_options.h"
diff --git a/src/mongo/db/write_concern.cpp b/src/mongo/db/write_concern.cpp
index 0668e4c54ad..c29254226e2 100644
--- a/src/mongo/db/write_concern.cpp
+++ b/src/mongo/db/write_concern.cpp
@@ -38,7 +38,7 @@
#include "mongo/db/commands/server_status_metric.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/repl/optime.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/server_options.h"
#include "mongo/db/service_context.h"
#include "mongo/db/stats/timer_stats.h"
diff --git a/src/mongo/dbtests/SConscript b/src/mongo/dbtests/SConscript
index ca58e8a4c4b..93e46007afc 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_interface",
+ "$BUILD_DIR/mongo/db/repl/repl_coordinator_global",
"$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 c70cd36807f..3cf58407b53 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.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/repl/replication_coordinator_mock.h"
#include "mongo/db/repl/storage_interface_mock.h"
#include "mongo/db/service_context.h"
@@ -152,11 +152,9 @@ int dbtestsMain(int argc, char** argv, char** envp) {
preciseClock->advance(Seconds(1));
service->setPreciseClockSource(std::move(preciseClock));
- repl::ReplicationCoordinator::set(
- service,
- std::unique_ptr<repl::ReplicationCoordinator>(
- new repl::ReplicationCoordinatorMock(service, replSettings)));
- repl::ReplicationCoordinator::get(getGlobalServiceContext())
+ repl::setGlobalReplicationCoordinator(
+ new repl::ReplicationCoordinatorMock(service, replSettings));
+ repl::getGlobalReplicationCoordinator()
->setFollowerMode(repl::MemberState::RS_PRIMARY)
.ignore();
diff --git a/src/mongo/dbtests/repltests.cpp b/src/mongo/dbtests/repltests.cpp
index 6306c4ce0db..cf66f4a4299 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.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/repl/replication_coordinator_mock.h"
#include "mongo/db/repl/sync_tail.h"
#include "mongo/dbtests/dbtests.h"
@@ -102,9 +102,7 @@ protected:
public:
Base()
- : _client(&_opCtx),
- _defaultReplSettings(
- ReplicationCoordinator::get(getGlobalServiceContext())->getSettings()) {
+ : _client(&_opCtx), _defaultReplSettings(getGlobalReplicationCoordinator()->getSettings()) {
// Replication is not supported by mobile SE.
if (mongo::storageGlobalParams.engine == "mobile") {
return;
@@ -112,10 +110,8 @@ public:
ReplSettings replSettings;
replSettings.setOplogSizeBytes(10 * 1024 * 1024);
replSettings.setMaster(true);
- ReplicationCoordinator::set(
- getGlobalServiceContext(),
- std::unique_ptr<repl::ReplicationCoordinator>(
- new repl::ReplicationCoordinatorMock(_opCtx.getServiceContext(), replSettings)));
+ setGlobalReplicationCoordinator(
+ 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
@@ -146,11 +142,9 @@ public:
try {
deleteAll(ns());
deleteAll(cllNS());
- repl::ReplicationCoordinator::set(
- getGlobalServiceContext(),
- std::unique_ptr<repl::ReplicationCoordinator>(new repl::ReplicationCoordinatorMock(
- _opCtx.getServiceContext(), _defaultReplSettings)));
- repl::ReplicationCoordinator::get(getGlobalServiceContext())
+ setGlobalReplicationCoordinator(new repl::ReplicationCoordinatorMock(
+ _opCtx.getServiceContext(), _defaultReplSettings));
+ repl::getGlobalReplicationCoordinator()
->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 e04f1a6e9cf..96ae39ebe48 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.h"
+#include "mongo/db/repl/replication_coordinator_global.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,9 +103,7 @@ public:
new repl::ReplicationCoordinatorMock(_opCtx->getServiceContext(), replSettings);
_coordinatorMock = coordinatorMock;
coordinatorMock->alwaysAllowWrites(true);
- repl::ReplicationCoordinator::set(
- _opCtx->getServiceContext(),
- std::unique_ptr<repl::ReplicationCoordinator>(coordinatorMock));
+ setGlobalReplicationCoordinator(coordinatorMock);
repl::StorageInterface::set(_opCtx->getServiceContext(),
stdx::make_unique<repl::StorageInterfaceImpl>());
@@ -302,8 +300,7 @@ public:
}
void setReplCoordAppliedOpTime(const repl::OpTime& opTime) {
- repl::ReplicationCoordinator::get(getGlobalServiceContext())
- ->setMyLastAppliedOpTime(opTime);
+ repl::getGlobalReplicationCoordinator()->setMyLastAppliedOpTime(opTime);
}
/**
diff --git a/src/mongo/s/SConscript b/src/mongo/s/SConscript
index 722599088bb..c6d286efa4b 100644
--- a/src/mongo/s/SConscript
+++ b/src/mongo/s/SConscript
@@ -325,7 +325,7 @@ env.Library(
],
LIBDEPS=[
'$BUILD_DIR/mongo/db/audit',
- '$BUILD_DIR/mongo/db/repl/repl_coordinator_interface',
+ '$BUILD_DIR/mongo/db/repl/repl_coordinator_global',
'$BUILD_DIR/mongo/util/concurrency/thread_pool',
'grid',
],
diff --git a/src/mongo/s/client/SConscript b/src/mongo/s/client/SConscript
index 42c73e33b15..1089e992f52 100644
--- a/src/mongo/s/client/SConscript
+++ b/src/mongo/s/client/SConscript
@@ -74,7 +74,7 @@ env.Library(
],
LIBDEPS=[
'$BUILD_DIR/mongo/client/clientdriver',
- '$BUILD_DIR/mongo/db/repl/repl_coordinator_interface',
+ '$BUILD_DIR/mongo/db/repl/repl_coordinator_global',
'rs_local_client',
'shard_interface'
],
diff --git a/src/mongo/s/client/shard_local.cpp b/src/mongo/s/client/shard_local.cpp
index b97ad3dc893..b9bca14bd9e 100644
--- a/src/mongo/s/client/shard_local.cpp
+++ b/src/mongo/s/client/shard_local.cpp
@@ -41,7 +41,7 @@
#include "mongo/db/dbdirectclient.h"
#include "mongo/db/repl/repl_client_info.h"
#include "mongo/db/repl/repl_set_config.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/rpc/get_status_from_command_result.h"
#include "mongo/rpc/unique_message.h"
#include "mongo/util/log.h"
@@ -56,9 +56,7 @@ ShardLocal::ShardLocal(const ShardId& id) : Shard(id), _rsLocalClient() {
}
const ConnectionString ShardLocal::getConnString() const {
- return repl::ReplicationCoordinator::get(getGlobalServiceContext())
- ->getConfig()
- .getConnectionString();
+ return repl::getGlobalReplicationCoordinator()->getConfig().getConnectionString();
}
std::shared_ptr<RemoteCommandTargeter> ShardLocal::getTargeter() const {
diff --git a/src/mongo/s/client/shard_local_test.cpp b/src/mongo/s/client/shard_local_test.cpp
index 2eaabd74703..a4760feff40 100644
--- a/src/mongo/s/client/shard_local_test.cpp
+++ b/src/mongo/s/client/shard_local_test.cpp
@@ -35,7 +35,7 @@
#include "mongo/db/client.h"
#include "mongo/db/query/cursor_response.h"
#include "mongo/db/query/find_and_modify_request.h"
-#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/repl/replication_coordinator_mock.h"
#include "mongo/db/service_context_d_test_fixture.h"
#include "mongo/db/write_concern_options.h"
@@ -85,18 +85,16 @@ void ShardLocalTest::setUp() {
serverGlobalParams.clusterRole = ClusterRole::ConfigServer;
_shardLocal = stdx::make_unique<ShardLocal>(ShardRegistry::kConfigServerShardId);
const repl::ReplSettings replSettings = {};
- repl::ReplicationCoordinator::set(
- getGlobalServiceContext(),
- std::unique_ptr<repl::ReplicationCoordinator>(
- new repl::ReplicationCoordinatorMock(_opCtx->getServiceContext(), replSettings)));
- ASSERT_OK(repl::ReplicationCoordinator::get(getGlobalServiceContext())
- ->setFollowerMode(repl::MemberState::RS_PRIMARY));
+ repl::setGlobalReplicationCoordinator(
+ new repl::ReplicationCoordinatorMock(_opCtx->getServiceContext(), replSettings));
+ ASSERT_OK(
+ repl::getGlobalReplicationCoordinator()->setFollowerMode(repl::MemberState::RS_PRIMARY));
}
void ShardLocalTest::tearDown() {
_opCtx.reset();
ServiceContextMongoDTest::tearDown();
- repl::ReplicationCoordinator::set(getGlobalServiceContext(), nullptr);
+ repl::setGlobalReplicationCoordinator(nullptr);
}
StatusWith<Shard::CommandResponse> ShardLocalTest::runFindAndModifyRunCommand(NamespaceString nss,