summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2015-03-13 16:27:18 -0400
committerBenety Goh <benety@mongodb.com>2015-03-17 11:06:11 -0400
commit6bc88dadc6adb4ef23505163c7e48484bc2f6908 (patch)
tree00e3079778040706000716ccadd878b526163744 /src
parentc7a10982bc3325c52eee6b85c782347899d2bc87 (diff)
downloadmongo-6bc88dadc6adb4ef23505163c7e48484bc2f6908.tar.gz
SERVER-17590 disallow --fastsync with replica sets
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/mongod_options.cpp4
-rw-r--r--src/mongo/db/repl/rs_initialsync.cpp19
2 files changed, 4 insertions, 19 deletions
diff --git a/src/mongo/db/mongod_options.cpp b/src/mongo/db/mongod_options.cpp
index 3fb50aa61a1..9a7a8780851 100644
--- a/src/mongo/db/mongod_options.cpp
+++ b/src/mongo/db/mongod_options.cpp
@@ -1048,6 +1048,10 @@ namespace mongo {
replSettings.slavedelay = params["slavedelay"].as<int>();
}
if (params.count("fastsync")) {
+ if (replSettings.slave != repl::SimpleSlave) {
+ return Status(ErrorCodes::BadValue,
+ str::stream() << "--fastsync must only be used with --slave");
+ }
replSettings.fastsync = params["fastsync"].as<bool>();
}
if (params.count("autoresync")) {
diff --git a/src/mongo/db/repl/rs_initialsync.cpp b/src/mongo/db/repl/rs_initialsync.cpp
index 1d3f17b1536..658dea2700a 100644
--- a/src/mongo/db/repl/rs_initialsync.cpp
+++ b/src/mongo/db/repl/rs_initialsync.cpp
@@ -302,25 +302,6 @@ namespace {
return Status(ErrorCodes::InitialSyncFailure, msg);
}
- if (getGlobalReplicationCoordinator()->getSettings().fastsync) {
- log() << "fastsync: skipping database clone";
-
- // prime oplog
- try {
- _tryToApplyOpWithRetry(&txn, &init, lastOp);
- std::deque<BSONObj> ops;
- ops.push_back(lastOp);
- writeOpsToOplog(&txn, ops);
- return Status::OK();
- } catch (DBException& e) {
- // Return if in shutdown
- if (inShutdown()) {
- return Status(ErrorCodes::ShutdownInProgress, "shutdown in progress");
- }
- throw;
- }
- }
-
// Add field to minvalid document to tell us to restart initial sync if we crash
setInitialSyncFlag(&txn);