summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mongo/SConscript3
-rw-r--r--src/mongo/db/db.cpp18
-rw-r--r--src/mongo/db/db.h2
-rw-r--r--src/mongo/db/mongod_options.cpp12
-rw-r--r--src/mongo/db/mongod_options.h3
-rw-r--r--src/mongo/db/repl/replication_initializer_impl.cpp59
-rw-r--r--src/mongo/db/repl/replication_initializer_legacy.cpp50
7 files changed, 126 insertions, 21 deletions
diff --git a/src/mongo/SConscript b/src/mongo/SConscript
index 8b5024a8a2b..de56daafc13 100644
--- a/src/mongo/SConscript
+++ b/src/mongo/SConscript
@@ -965,7 +965,8 @@ env.Library("mongodwebserver",
],
LIBDEPS=["coredb", "mongodandmongos"])
-mongodOnlyFiles = [ "db/db.cpp", "db/commands/touch.cpp", "db/mongod_options_init.cpp" ]
+mongodOnlyFiles = [ "db/db.cpp", "db/commands/touch.cpp", "db/mongod_options_init.cpp",
+ "db/repl/replication_initializer_${MONGO_REPL_IMPL}.cpp", ]
# ----- TARGETS ------
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index 3516ba4ffd4..baaa7dc2a80 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -69,9 +69,7 @@
#include "mongo/db/query/internal_plans.h"
#include "mongo/db/range_deleter_service.h"
#include "mongo/db/repair_database.h"
-#include "mongo/db/repl/network_interface_impl.h"
#include "mongo/db/repl/repl_coordinator_global.h"
-#include "mongo/db/repl/repl_coordinator_legacy.h"
#include "mongo/db/repl/repl_settings.h"
#include "mongo/db/restapi.h"
#include "mongo/db/server_parameters.h"
@@ -738,22 +736,6 @@ MONGO_INITIALIZER_GENERAL(CreateAuthorizationManager,
return Status::OK();
}
-namespace {
- repl::ReplSettings globalReplSettings;
-} // namespace
-
-namespace mongo {
- void setGlobalReplSettings(const repl::ReplSettings& settings) {
- globalReplSettings = settings;
- }
-} // namespace mongo
-
-MONGO_INITIALIZER_WITH_PREREQUISITES(CreateReplicationManager, ("SetGlobalEnvironment"))
- (InitializerContext* context) {
- repl::setGlobalReplicationCoordinator(new repl::LegacyReplicationCoordinator(globalReplSettings));
- return Status::OK();
-}
-
#ifdef MONGO_SSL
MONGO_INITIALIZER_GENERAL(setSSLManagerType,
MONGO_NO_PREREQUISITES,
diff --git a/src/mongo/db/db.h b/src/mongo/db/db.h
index 006f5a35c85..0786fae8cad 100644
--- a/src/mongo/db/db.h
+++ b/src/mongo/db/db.h
@@ -43,6 +43,4 @@ namespace repl {
extern void (*snmpInit)();
- void setGlobalReplSettings(const repl::ReplSettings& settings);
-
} // namespace mongo
diff --git a/src/mongo/db/mongod_options.cpp b/src/mongo/db/mongod_options.cpp
index dc482b2b754..3c921c1ccf5 100644
--- a/src/mongo/db/mongod_options.cpp
+++ b/src/mongo/db/mongod_options.cpp
@@ -1181,4 +1181,16 @@ namespace mongo {
return Status::OK();
}
+namespace {
+ repl::ReplSettings globalReplSettings;
+} // namespace
+
+ void setGlobalReplSettings(const repl::ReplSettings& settings) {
+ globalReplSettings = settings;
+ }
+
+ const repl::ReplSettings& getGlobalReplSettings() {
+ return globalReplSettings;
+ }
+
} // namespace mongo
diff --git a/src/mongo/db/mongod_options.h b/src/mongo/db/mongod_options.h
index 0843175533b..27dc9af10ab 100644
--- a/src/mongo/db/mongod_options.h
+++ b/src/mongo/db/mongod_options.h
@@ -85,4 +85,7 @@ namespace mongo {
StatusWith<repl::ReplSettings> parseMongodReplicationOptions(const moe::Environment& params);
Status storeMongodOptions(const moe::Environment& params, const std::vector<std::string>& args);
+
+ void setGlobalReplSettings(const repl::ReplSettings& settings);
+ const repl::ReplSettings& getGlobalReplSettings();
}
diff --git a/src/mongo/db/repl/replication_initializer_impl.cpp b/src/mongo/db/repl/replication_initializer_impl.cpp
new file mode 100644
index 00000000000..8e462e6ddee
--- /dev/null
+++ b/src/mongo/db/repl/replication_initializer_impl.cpp
@@ -0,0 +1,59 @@
+/**
+ * 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.
+ */
+
+#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kReplication
+
+#include "mongo/platform/basic.h"
+
+#include "mongo/base/init.h"
+#include "mongo/base/status.h"
+#include "mongo/db/mongod_options.h"
+#include "mongo/db/repl/repl_coordinator_external_state_impl.h"
+#include "mongo/db/repl/repl_coordinator_impl.h"
+#include "mongo/db/repl/repl_coordinator_global.h"
+#include "mongo/db/repl/repl_settings.h"
+#include "mongo/db/repl/network_interface_impl.h"
+#include "mongo/db/repl/topology_coordinator_impl.h"
+#include "mongo/util/time_support.h"
+
+namespace mongo {
+namespace {
+
+MONGO_INITIALIZER_WITH_PREREQUISITES(CreateReplicationManager, ("SetGlobalEnvironment"))
+ (InitializerContext* context) {
+ repl::setGlobalReplicationCoordinator(new repl::ReplicationCoordinatorImpl(
+ getGlobalReplSettings(),
+ new repl::ReplicationCoordinatorExternalStateImpl,
+ new repl::NetworkInterfaceImpl,
+ new repl::TopologyCoordinatorImpl(Seconds(repl::maxSyncSourceLagSecs)),
+ static_cast<int64_t>(curTimeMillis64())));
+ return Status::OK();
+}
+
+} // namespace
+} // namespace mongo
diff --git a/src/mongo/db/repl/replication_initializer_legacy.cpp b/src/mongo/db/repl/replication_initializer_legacy.cpp
new file mode 100644
index 00000000000..6856ad9c81b
--- /dev/null
+++ b/src/mongo/db/repl/replication_initializer_legacy.cpp
@@ -0,0 +1,50 @@
+/**
+ * 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.
+ */
+
+#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kReplication
+
+#include "mongo/platform/basic.h"
+
+#include "mongo/base/init.h"
+#include "mongo/db/mongod_options.h"
+#include "mongo/db/repl/repl_coordinator_global.h"
+#include "mongo/db/repl/repl_coordinator_legacy.h"
+#include "mongo/db/repl/repl_settings.h"
+
+namespace mongo {
+namespace {
+
+MONGO_INITIALIZER_WITH_PREREQUISITES(CreateReplicationManager, ("SetGlobalEnvironment"))
+ (InitializerContext* context) {
+ repl::setGlobalReplicationCoordinator(
+ new repl::LegacyReplicationCoordinator(getGlobalReplSettings()));
+ return Status::OK();
+}
+
+} // namespace
+} // namespace mongo