From e4735eb2de26e12c8048fdd85340f086bd8ab447 Mon Sep 17 00:00:00 2001 From: matt dannenberg Date: Fri, 23 May 2014 09:31:48 -0400 Subject: SERVER-14043 s/namespace replset/namespace repl/ --- src/mongo/db/catalog/collection.cpp | 2 +- src/mongo/db/catalog/index_catalog.cpp | 6 +-- src/mongo/db/catalog/index_create.cpp | 8 ++-- src/mongo/db/client.cpp | 6 +-- src/mongo/db/clientcursor.cpp | 2 +- src/mongo/db/cloner.cpp | 8 ++-- src/mongo/db/commands/apply_ops.cpp | 4 +- src/mongo/db/commands/auth_schema_upgrade_d.cpp | 16 +++---- src/mongo/db/commands/collection_to_capped.cpp | 4 +- src/mongo/db/commands/compact.cpp | 2 +- src/mongo/db/commands/create_indexes.cpp | 2 +- src/mongo/db/commands/drop_indexes.cpp | 2 +- src/mongo/db/commands/get_last_error.cpp | 6 +-- src/mongo/db/commands/mr.cpp | 14 +++--- src/mongo/db/commands/oplog_note.cpp | 4 +- src/mongo/db/commands/rename_collection.cpp | 2 +- src/mongo/db/commands/test_commands.cpp | 2 +- .../db/commands/write_commands/batch_executor.cpp | 12 ++--- src/mongo/db/db.cpp | 14 +++--- src/mongo/db/dbcommands.cpp | 46 +++++++++--------- src/mongo/db/dbhelpers.cpp | 4 +- .../db/index/btree_based_bulk_access_method.cpp | 2 +- src/mongo/db/index_builder.cpp | 2 +- src/mongo/db/index_rebuilder.cpp | 6 +-- src/mongo/db/instance.cpp | 18 +++---- src/mongo/db/mongod_options.cpp | 40 ++++++++-------- src/mongo/db/operation_context_impl.cpp | 2 +- src/mongo/db/ops/delete_executor.cpp | 6 +-- src/mongo/db/ops/update.cpp | 6 +-- src/mongo/db/pdfile.cpp | 2 +- src/mongo/db/prefetch.cpp | 10 ++-- src/mongo/db/query/new_find.cpp | 4 +- src/mongo/db/range_deleter_db_env.cpp | 6 +-- src/mongo/db/repl/bgsync.cpp | 4 +- src/mongo/db/repl/bgsync.h | 4 +- src/mongo/db/repl/connections.h | 4 +- src/mongo/db/repl/consensus.cpp | 4 +- src/mongo/db/repl/consensus.h | 4 +- src/mongo/db/repl/health.cpp | 6 +-- src/mongo/db/repl/health.h | 4 +- src/mongo/db/repl/heartbeat.cpp | 10 ++-- src/mongo/db/repl/heartbeat.h | 4 +- src/mongo/db/repl/heartbeat_info.cpp | 4 +- src/mongo/db/repl/heartbeat_info.h | 4 +- src/mongo/db/repl/initial_sync.cpp | 4 +- src/mongo/db/repl/initial_sync.h | 4 +- src/mongo/db/repl/is_master.h | 4 +- src/mongo/db/repl/manager.cpp | 4 +- src/mongo/db/repl/manager.h | 4 +- src/mongo/db/repl/master_slave.cpp | 4 +- src/mongo/db/repl/master_slave.h | 4 +- src/mongo/db/repl/member.cpp | 4 +- src/mongo/db/repl/member.h | 4 +- src/mongo/db/repl/member_state.h | 4 +- src/mongo/db/repl/multicmd.h | 4 +- src/mongo/db/repl/oplog.cpp | 6 +-- src/mongo/db/repl/oplog.h | 4 +- src/mongo/db/repl/oplogreader.cpp | 4 +- src/mongo/db/repl/oplogreader.h | 4 +- src/mongo/db/repl/repl_reads_ok.cpp | 4 +- src/mongo/db/repl/repl_reads_ok.h | 4 +- src/mongo/db/repl/repl_set.h | 4 +- src/mongo/db/repl/repl_set_health_poll_task.cpp | 4 +- src/mongo/db/repl/repl_set_health_poll_task.h | 4 +- src/mongo/db/repl/repl_set_impl.cpp | 6 +-- src/mongo/db/repl/repl_set_impl.h | 6 +-- src/mongo/db/repl/repl_settings.cpp | 4 +- src/mongo/db/repl/repl_settings.h | 4 +- src/mongo/db/repl/repl_start.cpp | 4 +- src/mongo/db/repl/repl_start.h | 4 +- src/mongo/db/repl/replset_commands.cpp | 6 +-- src/mongo/db/repl/replset_commands.h | 4 +- src/mongo/db/repl/replset_web_handler.cpp | 4 +- src/mongo/db/repl/resync.cpp | 4 +- src/mongo/db/repl/rs.cpp | 6 +-- src/mongo/db/repl/rs.h | 4 +- src/mongo/db/repl/rs_base.h | 4 +- src/mongo/db/repl/rs_config.cpp | 4 +- src/mongo/db/repl/rs_config.h | 4 +- src/mongo/db/repl/rs_exception.h | 4 +- src/mongo/db/repl/rs_initialsync.cpp | 16 +++---- src/mongo/db/repl/rs_initiate.cpp | 4 +- src/mongo/db/repl/rs_rollback.cpp | 4 +- src/mongo/db/repl/rs_sync.cpp | 8 ++-- src/mongo/db/repl/rs_sync.h | 4 +- src/mongo/db/repl/state_box.h | 4 +- src/mongo/db/repl/sync.cpp | 4 +- src/mongo/db/repl/sync.h | 4 +- src/mongo/db/repl/sync_source_feedback.cpp | 6 +-- src/mongo/db/repl/sync_source_feedback.h | 4 +- src/mongo/db/repl/sync_tail.cpp | 4 +- src/mongo/db/repl/sync_tail.h | 4 +- src/mongo/db/repl/topology_coordinator.h | 4 +- src/mongo/db/repl/topology_coordinator_impl.cpp | 4 +- src/mongo/db/repl/topology_coordinator_impl.h | 4 +- src/mongo/db/repl/write_concern.cpp | 4 +- src/mongo/db/repl/write_concern.h | 4 +- src/mongo/db/restapi.cpp | 16 +++---- src/mongo/db/ttl.cpp | 6 +-- src/mongo/db/write_concern.cpp | 14 +++--- src/mongo/dbtests/framework_options.cpp | 2 +- src/mongo/dbtests/mock/mock_replica_set.cpp | 12 ++--- src/mongo/dbtests/mock/mock_replica_set.h | 2 +- src/mongo/dbtests/replsettests.cpp | 56 +++++++++++----------- src/mongo/dbtests/repltests.cpp | 26 +++++----- src/mongo/s/d_migrate.cpp | 20 ++++---- src/mongo/s/d_state.cpp | 4 +- src/mongo/tools/oplog.cpp | 2 +- 108 files changed, 361 insertions(+), 361 deletions(-) (limited to 'src') diff --git a/src/mongo/db/catalog/collection.cpp b/src/mongo/db/catalog/collection.cpp index 27d0e98dda8..384efe40f82 100644 --- a/src/mongo/db/catalog/collection.cpp +++ b/src/mongo/db/catalog/collection.cpp @@ -329,7 +329,7 @@ namespace mongo { options.logIfError = false; options.dupsAllowed = !(KeyPattern::isIdKeyPattern(descriptor->keyPattern()) || descriptor->unique()) - || replset::ignoreUniqueIndex(descriptor); + || repl::ignoreUniqueIndex(descriptor); UpdateTicket* updateTicket = new UpdateTicket(); updateTickets.mutableMap()[descriptor] = updateTicket; Status ret = iam->validateUpdate(objOld, objNew, oldLocation, options, updateTicket ); diff --git a/src/mongo/db/catalog/index_catalog.cpp b/src/mongo/db/catalog/index_catalog.cpp index cfae22a3769..acef0995881 100644 --- a/src/mongo/db/catalog/index_catalog.cpp +++ b/src/mongo/db/catalog/index_catalog.cpp @@ -534,7 +534,7 @@ namespace mongo { if ( !IndexDescriptor::isIdIndexPattern( key ) ) { // for non _id indexes, we check to see if replication has turned off all indexes // we _always_ created _id index - if (replset::theReplSet && !replset::theReplSet->buildIndexes()) { + if (repl::theReplSet && !repl::theReplSet->buildIndexes()) { // this is not exactly the right error code, but I think will make the most sense return Status( ErrorCodes::IndexAlreadyExists, "no indexes per repl" ); } @@ -999,7 +999,7 @@ namespace mongo { KeyPattern::isIdKeyPattern(index->descriptor()->keyPattern()) || index->descriptor()->unique(); - options.dupsAllowed = replset::ignoreUniqueIndex(index->descriptor()) || !isUnique; + options.dupsAllowed = repl::ignoreUniqueIndex(index->descriptor()) || !isUnique; int64_t inserted; return index->accessMethod()->insert(txn, obj, loc, options, &inserted); @@ -1092,7 +1092,7 @@ namespace mongo { if ( !descriptor->unique() ) continue; - if (replset::ignoreUniqueIndex(descriptor)) + if (repl::ignoreUniqueIndex(descriptor)) continue; IndexAccessMethod* iam = getIndex( descriptor ); diff --git a/src/mongo/db/catalog/index_create.cpp b/src/mongo/db/catalog/index_create.cpp index a17b9a7e85b..c69b9bb2a93 100644 --- a/src/mongo/db/catalog/index_create.cpp +++ b/src/mongo/db/catalog/index_create.cpp @@ -63,7 +63,7 @@ namespace mongo { options.dupsAllowed = true; if ( descriptor->isIdIndex() || descriptor->unique() ) { - if (!replset::ignoreUniqueIndex(descriptor)) { + if (!repl::ignoreUniqueIndex(descriptor)) { options.dupsAllowed = false; } } @@ -132,7 +132,7 @@ namespace mongo { runner->saveState(); BSONObj toDelete; collection->deleteDocument( txn, loc, false, true, &toDelete ); - replset::logOp(txn, "d", ns.c_str(), toDelete); + repl::logOp(txn, "d", ns.c_str(), toDelete); if (!runner->restoreState(txn)) { // Runner got killed somehow. This probably shouldn't happen. @@ -272,8 +272,8 @@ namespace mongo { false /* cappedOk */, true /* noWarn */, &toDelete ); - if (replset::isMasterNs(ns.c_str())) { - replset::logOp(txn, "d", ns.c_str(), toDelete); + if (repl::isMasterNs(ns.c_str())) { + repl::logOp(txn, "d", ns.c_str(), toDelete); } txn->recoveryUnit()->commitIfNeeded(); diff --git a/src/mongo/db/client.cpp b/src/mongo/db/client.cpp index 1aed73b1087..21dd08f9b92 100644 --- a/src/mongo/db/client.cpp +++ b/src/mongo/db/client.cpp @@ -309,7 +309,7 @@ namespace mongo { void Client::appendLastOp( BSONObjBuilder& b ) const { // _lastOp is never set if replication is off - if (replset::theReplSet || !_lastOp.isNull()) { + if (repl::theReplSet || !_lastOp.isNull()) { b.appendTimestamp( "lastOp" , _lastOp.asDate() ); } } @@ -351,11 +351,11 @@ namespace mongo { _handshake = b.obj(); - if (!replset::theReplSet || !o.hasField("member")) { + if (!repl::theReplSet || !o.hasField("member")) { return false; } - return replset::theReplSet->registerSlave(_remoteId, o["member"].Int()); + return repl::theReplSet->registerSlave(_remoteId, o["member"].Int()); } bool ClientBasic::hasCurrent() { diff --git a/src/mongo/db/clientcursor.cpp b/src/mongo/db/clientcursor.cpp index 2b553fafb3f..5fa3654bfa8 100644 --- a/src/mongo/db/clientcursor.cpp +++ b/src/mongo/db/clientcursor.cpp @@ -164,7 +164,7 @@ namespace mongo { void ClientCursor::updateSlaveLocation( CurOp& curop ) { if ( _slaveReadTill.isNull() ) return; - mongo::replset::updateSlaveLocation(curop, _ns.c_str(), _slaveReadTill); + mongo::repl::updateSlaveLocation(curop, _ns.c_str(), _slaveReadTill); } // diff --git a/src/mongo/db/cloner.cpp b/src/mongo/db/cloner.cpp index d733c599c5e..d1b97e9be3a 100644 --- a/src/mongo/db/cloner.cpp +++ b/src/mongo/db/cloner.cpp @@ -164,7 +164,7 @@ namespace mongo { } uassertStatusOK( loc.getStatus() ); if (logForRepl) - replset::logOp(txn, "i", to_collection, js); + repl::logOp(txn, "i", to_collection, js); txn->recoveryUnit()->commitIfNeeded(); @@ -250,7 +250,7 @@ namespace mongo { } if (logForRepl) - replset::logOp(txn, "i", to_collection, spec); + repl::logOp(txn, "i", to_collection, spec); txn->recoveryUnit()->commitIfNeeded(); @@ -287,7 +287,7 @@ namespace mongo { // cloner owns _conn in auto_ptr cloner.setConnection(tmpConn); uassert(15908, errmsg, - tmpConn->connect(host, errmsg) && replset::replAuthenticate(tmpConn)); + tmpConn->connect(host, errmsg) && repl::replAuthenticate(tmpConn)); return cloner.copyCollection(txn, ns, BSONObj(), errmsg, true, false, true, false); } @@ -371,7 +371,7 @@ namespace mongo { auto_ptr con( cs.connect( errmsg )); if ( !con.get() ) return false; - if (!replset::replAuthenticate(con.get())) + if (!repl::replAuthenticate(con.get())) return false; _conn = con; diff --git a/src/mongo/db/commands/apply_ops.cpp b/src/mongo/db/commands/apply_ops.cpp index ed8d788d650..ef3c2ea2ab9 100644 --- a/src/mongo/db/commands/apply_ops.cpp +++ b/src/mongo/db/commands/apply_ops.cpp @@ -131,7 +131,7 @@ namespace mongo { invariant(Lock::nested()); Client::Context ctx(ns); - bool failed = replset::applyOperation_inlock(txn, + bool failed = repl::applyOperation_inlock(txn, ctx.db(), temp, false, @@ -166,7 +166,7 @@ namespace mongo { } } - replset::logOp(txn, "c", tempNS.c_str(), cmdBuilder.done()); + repl::logOp(txn, "c", tempNS.c_str(), cmdBuilder.done()); } return errors == 0; diff --git a/src/mongo/db/commands/auth_schema_upgrade_d.cpp b/src/mongo/db/commands/auth_schema_upgrade_d.cpp index b6874f1549e..3a52792615e 100644 --- a/src/mongo/db/commands/auth_schema_upgrade_d.cpp +++ b/src/mongo/db/commands/auth_schema_upgrade_d.cpp @@ -43,20 +43,20 @@ namespace mongo { namespace { Status checkReplicaMemberVersions() { - if (!replset::theReplSet) + if (!repl::theReplSet) return Status::OK(); - std::list rsMembers; + std::list rsMembers; try { - const unsigned rsSelfId = replset::theReplSet->selfId(); - const std::vector& rsMemberConfigs = - replset::theReplSet->config().members; + const unsigned rsSelfId = repl::theReplSet->selfId(); + const std::vector& rsMemberConfigs = + repl::theReplSet->config().members; for (size_t i = 0; i < rsMemberConfigs.size(); ++i) { const unsigned otherId = rsMemberConfigs[i]._id; if (rsSelfId == otherId) continue; - const replset::Member* other = replset::theReplSet->findById(otherId); + const repl::Member* other = repl::theReplSet->findById(otherId); if (!other) { log() << "During authSchemaUpgrade, no information about replica set member " "with id " << otherId << "; ignoring."; @@ -67,7 +67,7 @@ namespace { " is down; ignoring."; continue; } - rsMembers.push_back(replset::Target(other->fullName())); + rsMembers.push_back(repl::Target(other->fullName())); } multiCommand(BSON("buildInfo" << 1), rsMembers); @@ -76,7 +76,7 @@ namespace { return ex.toStatus(); } - for (std::list::const_iterator iter = rsMembers.begin(); + for (std::list::const_iterator iter = rsMembers.begin(); iter != rsMembers.end(); ++iter) { diff --git a/src/mongo/db/commands/collection_to_capped.cpp b/src/mongo/db/commands/collection_to_capped.cpp index e2f6c29c940..d2a909f4af4 100644 --- a/src/mongo/db/commands/collection_to_capped.cpp +++ b/src/mongo/db/commands/collection_to_capped.cpp @@ -107,7 +107,7 @@ namespace mongo { toCollection->insertDocument( txn, obj, true ); if ( logForReplication ) - replset::logOp(txn, "i", toNs.c_str(), obj); + repl::logOp(txn, "i", toNs.c_str(), obj); txn->recoveryUnit()->commitIfNeeded(); } } @@ -241,7 +241,7 @@ namespace mongo { return appendCommandStatus( result, status ); if (!fromRepl) - replset::logOp(txn, "c",(dbname + ".$cmd").c_str(), jsobj); + repl::logOp(txn, "c",(dbname + ".$cmd").c_str(), jsobj); return true; } } cmdConvertToCapped; diff --git a/src/mongo/db/commands/compact.cpp b/src/mongo/db/commands/compact.cpp index a9384134c3a..3355e222570 100644 --- a/src/mongo/db/commands/compact.cpp +++ b/src/mongo/db/commands/compact.cpp @@ -88,7 +88,7 @@ namespace mongo { return false; } - if (replset::isCurrentlyAReplSetPrimary() && !cmdObj["force"].trueValue()) { + if (repl::isCurrentlyAReplSetPrimary() && !cmdObj["force"].trueValue()) { errmsg = "will not run compact on an active replica set primary as this is a slow blocking operation. use force:true to force"; return false; } diff --git a/src/mongo/db/commands/create_indexes.cpp b/src/mongo/db/commands/create_indexes.cpp index 3917cd8cfb8..2519bc75cc4 100644 --- a/src/mongo/db/commands/create_indexes.cpp +++ b/src/mongo/db/commands/create_indexes.cpp @@ -204,7 +204,7 @@ namespace mongo { if ( !fromRepl ) { std::string systemIndexes = ns.getSystemIndexesCollection(); - replset::logOp(txn, "i", systemIndexes.c_str(), spec); + repl::logOp(txn, "i", systemIndexes.c_str(), spec); } } diff --git a/src/mongo/db/commands/drop_indexes.cpp b/src/mongo/db/commands/drop_indexes.cpp index 98ad677ea93..ab9144b7c96 100644 --- a/src/mongo/db/commands/drop_indexes.cpp +++ b/src/mongo/db/commands/drop_indexes.cpp @@ -96,7 +96,7 @@ namespace mongo { Lock::DBWrite dbXLock(dbname); bool ok = wrappedRun(txn, dbname, jsobj, errmsg, anObjBuilder); if (ok && !fromRepl) - replset::logOp(txn, "c",(dbname + ".$cmd").c_str(), jsobj); + repl::logOp(txn, "c",(dbname + ".$cmd").c_str(), jsobj); return ok; } bool wrappedRun(OperationContext* txn, diff --git a/src/mongo/db/commands/get_last_error.cpp b/src/mongo/db/commands/get_last_error.cpp index 2e552c97e92..d852dd5adee 100644 --- a/src/mongo/db/commands/get_last_error.cpp +++ b/src/mongo/db/commands/get_last_error.cpp @@ -212,7 +212,7 @@ namespace mongo { // If we got an electionId, make sure it matches if (electionIdPresent) { - if (!replset::theReplSet) { + if (!repl::theReplSet) { // Ignore electionIds of 0 from mongos. if (electionId != OID()) { errmsg = "wElectionId passed but no replication active"; @@ -221,9 +221,9 @@ namespace mongo { } } else { - if (electionId != replset::theReplSet->getElectionId()) { + if (electionId != repl::theReplSet->getElectionId()) { LOG(3) << "oid passed in is " << electionId - << ", but our id is " << replset::theReplSet->getElectionId(); + << ", but our id is " << repl::theReplSet->getElectionId(); errmsg = "election occurred after write"; result.append("code", ErrorCodes::WriteConcernFailed); return false; diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp index 0ed360ca385..af99dfa6818 100644 --- a/src/mongo/db/commands/mr.cpp +++ b/src/mongo/db/commands/mr.cpp @@ -404,7 +404,7 @@ namespace mongo { b.append( "create", nsToCollectionSubstring( _config.tempNamespace )); b.appendElements( options.toBSON() ); string logNs = nsToDatabase( _config.tempNamespace ) + ".$cmd"; - replset::logOp(_txn, "c", logNs.c_str(), b.obj()); + repl::logOp(_txn, "c", logNs.c_str(), b.obj()); } for ( vector::iterator it = indexesToInsert.begin(); @@ -412,7 +412,7 @@ namespace mongo { tempColl->getIndexCatalog()->createIndex(_txn, *it, false ); // Log the createIndex operation. string logNs = nsToDatabase( _config.tempNamespace ) + ".system.indexes"; - replset::logOp(_txn, "i", logNs.c_str(), *it); + repl::logOp(_txn, "i", logNs.c_str(), *it); } } @@ -636,7 +636,7 @@ namespace mongo { BSONObj bo = b.obj(); coll->insertDocument( _txn, bo, true ); - replset::logOp(_txn, "i", ns.c_str(), bo); + repl::logOp(_txn, "i", ns.c_str(), bo); } /** @@ -1182,7 +1182,7 @@ namespace mongo { /* why !replset ? bad things happen with --slave (i think because of this) */ - virtual bool slaveOk() const { return !replset::replSet; } + virtual bool slaveOk() const { return !repl::replSet; } virtual bool slaveOverrideOk() const { return true; } @@ -1238,10 +1238,10 @@ namespace mongo { return false; } - if (replset::replSet && state.isOnDisk()) { + if (repl::replSet && state.isOnDisk()) { // this means that it will be doing a write operation, make sure we are on Master // ideally this check should be in slaveOk(), but at that point config is not known - if (!replset::isMasterNs(dbname.c_str())) { + if (!repl::isMasterNs(dbname.c_str())) { errmsg = "not master"; return false; } @@ -1428,7 +1428,7 @@ namespace mongo { public: void help(stringstream& h) const { h << "internal"; } MapReduceFinishCommand() : Command( "mapreduce.shardedfinish" ) {} - virtual bool slaveOk() const { return !replset::replSet; } + virtual bool slaveOk() const { return !repl::replSet; } virtual bool slaveOverrideOk() const { return true; } virtual bool isWriteCommandForConfigServer() const { return false; } virtual void addRequiredPrivileges(const std::string& dbname, diff --git a/src/mongo/db/commands/oplog_note.cpp b/src/mongo/db/commands/oplog_note.cpp index ef4b9bb3fa0..92ce1ebcd14 100644 --- a/src/mongo/db/commands/oplog_note.cpp +++ b/src/mongo/db/commands/oplog_note.cpp @@ -62,7 +62,7 @@ namespace mongo { string& errmsg, BSONObjBuilder& result, bool fromRepl) { - if (!replset::replSettings.master) { + if (!repl::replSettings.master) { return appendCommandStatus(result, Status( ErrorCodes::NoReplicationEnabled, "Must have replication set up to run \"appendOplogNote\"")); @@ -73,7 +73,7 @@ namespace mongo { return appendCommandStatus(result, status); } - replset::logOpComment(dataElement.Obj()); + repl::logOpComment(dataElement.Obj()); return true; } diff --git a/src/mongo/db/commands/rename_collection.cpp b/src/mongo/db/commands/rename_collection.cpp index f4ed505cb63..ac31b040f75 100644 --- a/src/mongo/db/commands/rename_collection.cpp +++ b/src/mongo/db/commands/rename_collection.cpp @@ -95,7 +95,7 @@ namespace mongo { Lock::GlobalWrite globalWriteLock; bool ok = wrappedRun(txn, dbname, cmdObj, errmsg, result, fromRepl); if (ok && !fromRepl) - replset::logOp(txn, "c",(dbname + ".$cmd").c_str(), cmdObj); + repl::logOp(txn, "c",(dbname + ".$cmd").c_str(), cmdObj); return ok; } virtual bool wrappedRun(OperationContext* txn, diff --git a/src/mongo/db/commands/test_commands.cpp b/src/mongo/db/commands/test_commands.cpp index cd41ad17488..006a86d3677 100644 --- a/src/mongo/db/commands/test_commands.cpp +++ b/src/mongo/db/commands/test_commands.cpp @@ -199,7 +199,7 @@ namespace mongo { IndexBuilder::restoreIndexes(indexes); if (!fromRepl) - replset::logOp(txn, "c",(dbname + ".$cmd").c_str(), cmdObj); + repl::logOp(txn, "c",(dbname + ".$cmd").c_str(), cmdObj); return true; } }; diff --git a/src/mongo/db/commands/write_commands/batch_executor.cpp b/src/mongo/db/commands/write_commands/batch_executor.cpp index 9e936a54275..a6332a50288 100644 --- a/src/mongo/db/commands/write_commands/batch_executor.cpp +++ b/src/mongo/db/commands/write_commands/batch_executor.cpp @@ -353,10 +353,10 @@ namespace mongo { response->setWriteConcernError( wcError.release() ); } - if (replset::anyReplEnabled()) { + if (repl::anyReplEnabled()) { response->setLastOp( _client->getLastOp() ); - if (replset::theReplSet) { - response->setElectionId(replset::theReplSet->getElectionId()); + if (repl::theReplSet) { + response->setElectionId(repl::theReplSet->getElectionId()); } } @@ -434,7 +434,7 @@ namespace mongo { } static bool checkIsMasterForCollection(const std::string& ns, WriteOpResult* result) { - if (!replset::isMasterNs(ns.c_str())) { + if (!repl::isMasterNs(ns.c_str())) { WriteErrorDetail* errorDetail = new WriteErrorDetail; result->setError(errorDetail); errorDetail->setErrCode(ErrorCodes::NotMaster); @@ -1030,7 +1030,7 @@ namespace mongo { result->setError(toWriteError(status.getStatus())); } else { - replset::logOp( txn, "i", insertNS.c_str(), docToInsert ); + repl::logOp( txn, "i", insertNS.c_str(), docToInsert ); txn->recoveryUnit()->commitIfNeeded(); result->getStats().n = 1; } @@ -1060,7 +1060,7 @@ namespace mongo { result->setError(toWriteError(status)); } else { - replset::logOp( txn, "i", indexNS.c_str(), indexDesc ); + repl::logOp( txn, "i", indexNS.c_str(), indexDesc ); result->getStats().n = 1; } } diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp index 318c9b740a6..cd9a98b3a7c 100644 --- a/src/mongo/db/db.cpp +++ b/src/mongo/db/db.cpp @@ -279,7 +279,7 @@ namespace mongo { server->setupSockets(); logStartup(); - replset::startReplication(); + repl::startReplication(); if (serverGlobalParams.isHttpInterfaceEnabled) boost::thread web( stdx::bind(&webServerThread, new RestAdminAccess(), // takes ownership @@ -371,7 +371,7 @@ namespace mongo { DataFile *p = ctx.db()->getExtentManager()->getFile( &txn, 0 ); DataFileHeader *h = p->getHeader(); - if (replset::replSettings.usingReplSets()) { + if (repl::replSettings.usingReplSets()) { // we only care about the _id index if we are in a replset checkForIdIndexes(ctx.db()); } @@ -478,7 +478,7 @@ namespace mongo { */ unsigned long long checkIfReplMissingFromCommandLine() { Lock::GlobalWrite lk; // this is helpful for the query below to work as you can't open files when readlocked - if (!replset::replSettings.usingReplSets()) { + if (!repl::replSettings.usingReplSets()) { DBDirectClient c; return c.count("local.system.replset"); } @@ -653,8 +653,8 @@ namespace mongo { l << "MongoDB starting : pid=" << pid << " port=" << serverGlobalParams.port << " dbpath=" << storageGlobalParams.dbpath; - if( replset::replSettings.master ) l << " master=" << replset::replSettings.master; - if( replset::replSettings.slave ) l << " slave=" << (int) replset::replSettings.slave; + if( repl::replSettings.master ) l << " master=" << repl::replSettings.master; + if( repl::replSettings.slave ) l << " slave=" << (int) repl::replSettings.slave; l << ( is32bit ? " 32" : " 64" ) << "-bit host=" << getHostNameCached() << endl; } DEV log() << "_DEBUG build (which is slower)" << endl; @@ -723,8 +723,8 @@ namespace mongo { // promotion to primary. On pure slaves, they are only cleared when the oplog tells them to. // The local DB is special because it is not replicated. See SERVER-10927 for more details. const bool shouldClearNonLocalTmpCollections =!(missingRepl - || replset::replSettings.usingReplSets() - || replset::replSettings.slave == replset::SimpleSlave); + || repl::replSettings.usingReplSets() + || repl::replSettings.slave == repl::SimpleSlave); repairDatabasesAndCheckVersion(shouldClearNonLocalTmpCollections); if (mongodGlobalParams.upgrade) diff --git a/src/mongo/db/dbcommands.cpp b/src/mongo/db/dbcommands.cpp index 814fcdee079..3fa6918ad50 100644 --- a/src/mongo/db/dbcommands.cpp +++ b/src/mongo/db/dbcommands.cpp @@ -96,24 +96,24 @@ namespace mongo { bool force = cmdObj.hasField("force") && cmdObj["force"].trueValue(); if (!force && - replset::theReplSet && - replset::theReplSet->getConfig().members.size() > 1 && - replset::theReplSet->isPrimary()) { + repl::theReplSet && + repl::theReplSet->getConfig().members.size() > 1 && + repl::theReplSet->isPrimary()) { long long timeout, now, start; timeout = now = start = curTimeMicros64()/1000000; if (cmdObj.hasField("timeoutSecs")) { timeout += cmdObj["timeoutSecs"].numberLong(); } - OpTime lastOp = replset::theReplSet->lastOpTimeWritten; - OpTime closest = replset::theReplSet->lastOtherOpTime(); + OpTime lastOp = repl::theReplSet->lastOpTimeWritten; + OpTime closest = repl::theReplSet->lastOtherOpTime(); long long int diff = lastOp.getSecs() - closest.getSecs(); while (now <= timeout && (diff < 0 || diff > 10)) { sleepsecs(1); now++; - lastOp = replset::theReplSet->lastOpTimeWritten; - closest = replset::theReplSet->lastOtherOpTime(); + lastOp = repl::theReplSet->lastOpTimeWritten; + closest = repl::theReplSet->lastOtherOpTime(); diff = lastOp.getSecs() - closest.getSecs(); } @@ -125,13 +125,13 @@ namespace mongo { } // step down - replset::theReplSet->stepDown(120); + repl::theReplSet->stepDown(120); log() << "waiting for secondaries to catch up" << endl; - lastOp = replset::theReplSet->lastOpTimeWritten; + lastOp = repl::theReplSet->lastOpTimeWritten; while (lastOp != closest && now - start < 60) { - closest = replset::theReplSet->lastOtherOpTime(); + closest = repl::theReplSet->lastOtherOpTime(); now++; sleepsecs(1); @@ -217,7 +217,7 @@ namespace mongo { log() << "dropDatabase " << dbname << " finished"; if (!fromRepl) - replset::logOp(txn, "c",(dbname + ".$cmd").c_str(), cmdObj); + repl::logOp(txn, "c",(dbname + ".$cmd").c_str(), cmdObj); } result.append( "dropped" , dbname ); @@ -479,7 +479,7 @@ namespace mongo { if ( s.isOK() ) { if (!fromRepl) - replset::logOp(txn, "c",(dbname + ".$cmd").c_str(), cmdObj); + repl::logOp(txn, "c",(dbname + ".$cmd").c_str(), cmdObj); return true; } @@ -496,7 +496,7 @@ namespace mongo { CmdCount() : Command("count") { } virtual bool slaveOk() const { // ok on --slave setups - return replset::replSettings.slave == replset::SimpleSlave; + return repl::replSettings.slave == repl::SimpleSlave; } virtual bool slaveOverrideOk() const { return true; } virtual bool maintenanceOk() const { return false; } @@ -1198,7 +1198,7 @@ namespace mongo { } if (ok && !fromRepl) - replset::logOp(txn, "c",(dbname + ".$cmd").c_str(), jsobj); + repl::logOp(txn, "c",(dbname + ".$cmd").c_str(), jsobj); return ok; } @@ -1310,11 +1310,11 @@ namespace mongo { assumption needs to be audited and documented. */ class MaintenanceModeSetter { public: - MaintenanceModeSetter() : maintenanceModeSet(replset::theReplSet->setMaintenanceMode(true)) + MaintenanceModeSetter() : maintenanceModeSet(repl::theReplSet->setMaintenanceMode(true)) {} ~MaintenanceModeSetter() { if(maintenanceModeSet) - replset::theReplSet->setMaintenanceMode(false); + repl::theReplSet->setMaintenanceMode(false); } private: bool maintenanceModeSet; @@ -1408,7 +1408,7 @@ namespace mongo { } bool canRunHere = - replset::isMasterNs(dbname.c_str()) || + repl::isMasterNs(dbname.c_str()) || c->slaveOk() || ( c->slaveOverrideOk() && ( queryOptions & QueryOption_SlaveOk ) ) || fromRepl; @@ -1420,9 +1420,9 @@ namespace mongo { } if (!c->maintenanceOk() - && replset::theReplSet - && !replset::isMasterNs(dbname.c_str()) - && !replset::theReplSet->isSecondary()) { + && repl::theReplSet + && !repl::isMasterNs(dbname.c_str()) + && !repl::theReplSet->isSecondary()) { result.append( "note" , "from execCommand" ); appendCommandStatus(result, false, "node is recovering"); return; @@ -1434,7 +1434,7 @@ namespace mongo { client.curop()->setCommand(c); - if (c->maintenanceMode() && replset::theReplSet) { + if (c->maintenanceMode() && repl::theReplSet) { mmSetter.reset(new MaintenanceModeSetter()); } @@ -1478,12 +1478,12 @@ namespace mongo { appendCommandStatus(result, retval, errmsg); // For commands from mongos, append some info to help getLastError(w) work. - if (replset::theReplSet) { + if (repl::theReplSet) { // Detect mongos connections by looking for setShardVersion to have been run previously // on this connection. if (shardingState.needCollectionMetadata(dbname)) { appendGLEHelperData(result, client.getLastOp(), - replset::theReplSet->getElectionId()); + repl::theReplSet->getElectionId()); } } return; diff --git a/src/mongo/db/dbhelpers.cpp b/src/mongo/db/dbhelpers.cpp index b2cd7e0b413..767bf537d1f 100644 --- a/src/mongo/db/dbhelpers.cpp +++ b/src/mongo/db/dbhelpers.cpp @@ -440,14 +440,14 @@ namespace mongo { BSONObj deletedId; collection->deleteDocument( txn, rloc, false, false, &deletedId ); // The above throws on failure, and so is not logged - replset::logOp(txn, "d", ns.c_str(), deletedId, 0, 0, fromMigrate); + repl::logOp(txn, "d", ns.c_str(), deletedId, 0, 0, fromMigrate); numDeleted++; } Timer secondaryThrottleTime; if ( secondaryThrottle && numDeleted > 0 ) { - if (!replset::waitForReplication(c.getLastOp(), 2, 60 /* seconds to wait */)) { + if (!repl::waitForReplication(c.getLastOp(), 2, 60 /* seconds to wait */)) { warning() << "replication to secondaries for removeRange at least 60 seconds behind" << endl; } millisWaitingForReplication += secondaryThrottleTime.millis(); diff --git a/src/mongo/db/index/btree_based_bulk_access_method.cpp b/src/mongo/db/index/btree_based_bulk_access_method.cpp index c750b1097ed..b64daa59d2e 100644 --- a/src/mongo/db/index/btree_based_bulk_access_method.cpp +++ b/src/mongo/db/index/btree_based_bulk_access_method.cpp @@ -129,7 +129,7 @@ namespace mongo { IndexCatalogEntry* entry = _real->_btreeState; bool dupsAllowed = !entry->descriptor()->unique() - || replset::ignoreUniqueIndex(entry->descriptor()); + || repl::ignoreUniqueIndex(entry->descriptor()); bool dropDups = entry->descriptor()->dropDups() || inDBRepair; diff --git a/src/mongo/db/index_builder.cpp b/src/mongo/db/index_builder.cpp index c5a0c6ab3f1..6014608300c 100644 --- a/src/mongo/db/index_builder.cpp +++ b/src/mongo/db/index_builder.cpp @@ -58,7 +58,7 @@ namespace mongo { Client::initThread(name().c_str()); Lock::ParallelBatchWriterMode::iAmABatchParticipant(); - replset::replLocalAuth(); + repl::replLocalAuth(); cc().curop()->reset(HostAndPort(), dbInsert); NamespaceString ns(_index["ns"].String()); diff --git a/src/mongo/db/index_rebuilder.cpp b/src/mongo/db/index_rebuilder.cpp index d158115f261..3e45d143cab 100644 --- a/src/mongo/db/index_rebuilder.cpp +++ b/src/mongo/db/index_rebuilder.cpp @@ -72,9 +72,9 @@ namespace mongo { catch (const DBException& e) { warning() << "Index rebuilding did not complete: " << e.what() << endl; } - boost::unique_lock lk(replset::ReplSet::rss.mtx); - replset::ReplSet::rss.indexRebuildDone = true; - replset::ReplSet::rss.cond.notify_all(); + boost::unique_lock lk(repl::ReplSet::rss.mtx); + repl::ReplSet::rss.indexRebuildDone = true; + repl::ReplSet::rss.cond.notify_all(); LOG(1) << "checking complete" << endl; } diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp index cb34efb0810..613165ff4d2 100644 --- a/src/mongo/db/instance.cpp +++ b/src/mongo/db/instance.cpp @@ -548,7 +548,7 @@ namespace mongo { Database *database = ctx->db(); verify( database->name() == db ); - replset::oplogCheckCloseDatabase(database); // oplog caches some things, dirty its caches + repl::oplogCheckCloseDatabase(database); // oplog caches some things, dirty its caches if( BackgroundOperation::inProgForDb(db) ) { log() << "warning: bg op in prog during close db? " << db << endl; @@ -697,7 +697,7 @@ namespace mongo { last = getLastSetOptime(); } else { - replset::waitForOptimeChange(last, 1000/*ms*/); + repl::waitForOptimeChange(last, 1000/*ms*/); } } @@ -811,7 +811,7 @@ namespace mongo { return; uassertStatusOK( status ); - replset::logOp(txn, "i", ns, js); + repl::logOp(txn, "i", ns, js); return; } @@ -828,7 +828,7 @@ namespace mongo { StatusWith status = collection->insertDocument( txn, js, true ); uassertStatusOK( status.getStatus() ); - replset::logOp(txn, "i", ns, js); + repl::logOp(txn, "i", ns, js); } NOINLINE_DECL void insertMulti(OperationContext* txn, @@ -884,7 +884,7 @@ namespace mongo { // CONCURRENCY TODO: is being read locked in big log sufficient here? // writelock is used to synchronize stepdowns w/ writes - uassert(10058 , "not master", replset::isMasterNs(ns)); + uassert(10058 , "not master", repl::isMasterNs(ns)); if ( handlePossibleShardedMessage( m , 0 ) ) return; @@ -933,9 +933,9 @@ namespace mongo { return true; // we have a local database. return true if oplog isn't empty { - Lock::DBRead lk(replset::rsoplog); + Lock::DBRead lk(repl::rsoplog); BSONObj o; - if( Helpers::getFirst(replset::rsoplog, o) ) + if( Helpers::getFirst(repl::rsoplog, o) ) return true; } } @@ -1115,8 +1115,8 @@ namespace { void exitCleanly( ExitCode code ) { killCurrentOp.killAll(); - if (replset::theReplSet) { - replset::theReplSet->shutdown(); + if (repl::theReplSet) { + repl::theReplSet->shutdown(); } { diff --git a/src/mongo/db/mongod_options.cpp b/src/mongo/db/mongod_options.cpp index 3d05338729b..2eb713ba92e 100644 --- a/src/mongo/db/mongod_options.cpp +++ b/src/mongo/db/mongod_options.cpp @@ -1002,36 +1002,36 @@ namespace mongo { storageGlobalParams.noTableScan = params["notablescan"].as(); } if (params.count("master")) { - replset::replSettings.master = params["master"].as(); + repl::replSettings.master = params["master"].as(); } if (params.count("slave") && params["slave"].as() == true) { - replset::replSettings.slave = replset::SimpleSlave; + repl::replSettings.slave = repl::SimpleSlave; } if (params.count("slavedelay")) { - replset::replSettings.slavedelay = params["slavedelay"].as(); + repl::replSettings.slavedelay = params["slavedelay"].as(); } if (params.count("fastsync")) { - replset::replSettings.fastsync = params["fastsync"].as(); + repl::replSettings.fastsync = params["fastsync"].as(); } if (params.count("autoresync")) { - replset::replSettings.autoresync = params["autoresync"].as(); + repl::replSettings.autoresync = params["autoresync"].as(); } if (params.count("source")) { /* specifies what the source in local.sources should be */ - replset::replSettings.source = params["source"].as().c_str(); + repl::replSettings.source = params["source"].as().c_str(); } if( params.count("pretouch") ) { - replset::replSettings.pretouch = params["pretouch"].as(); + repl::replSettings.pretouch = params["pretouch"].as(); } if (params.count("replication.replSetName")) { - replset::replSettings.replSet = params["replication.replSetName"].as().c_str(); + repl::replSettings.replSet = params["replication.replSetName"].as().c_str(); } if (params.count("replication.replSet")) { /* seed list of hosts for the repl set */ - replset::replSettings.replSet = params["replication.replSet"].as().c_str(); + repl::replSettings.replSet = params["replication.replSet"].as().c_str(); } if (params.count("replication.secondaryIndexPrefetch")) { - replset::replSettings.rsIndexPrefetch = + repl::replSettings.rsIndexPrefetch = params["replication.secondaryIndexPrefetch"].as(); } @@ -1040,7 +1040,7 @@ namespace mongo { } if (params.count("only")) { - replset::replSettings.only = params["only"].as().c_str(); + repl::replSettings.only = params["only"].as().c_str(); } if( params.count("storage.nsSize") ) { int x = params["storage.nsSize"].as(); @@ -1062,8 +1062,8 @@ namespace mongo { << "MB is too big for 32 bit version. Use 64 bit build instead."; return Status(ErrorCodes::BadValue, sb.str()); } - replset::replSettings.oplogSize = x * 1024 * 1024; - verify(replset::replSettings.oplogSize > 0); + repl::replSettings.oplogSize = x * 1024 * 1024; + verify(repl::replSettings.oplogSize > 0); } if (params.count("cacheSize")) { long x = params["cacheSize"].as(); @@ -1098,9 +1098,9 @@ namespace mongo { params["sharding.clusterRole"].as() == "configsvr") { serverGlobalParams.configsvr = true; storageGlobalParams.smallfiles = true; // config server implies small files - if (replset::replSettings.usingReplSets() - || replset::replSettings.master - || replset::replSettings.slave) { + if (repl::replSettings.usingReplSets() + || repl::replSettings.master + || repl::replSettings.slave) { return Status(ErrorCodes::BadValue, "replication should not be enabled on a config server"); } @@ -1113,9 +1113,9 @@ namespace mongo { if (!params.count("storage.dbPath")) storageGlobalParams.dbpath = "/data/configdb"; - replset::replSettings.master = true; + repl::replSettings.master = true; if (!params.count("replication.oplogSizeMB")) - replset::replSettings.oplogSize = 5 * 1024 * 1024; + repl::replSettings.oplogSize = 5 * 1024 * 1024; } if (params.count("sharding.archiveMovedChunks")) { @@ -1150,8 +1150,8 @@ namespace mongo { storageGlobalParams.repairpath = storageGlobalParams.dbpath; } - if (replset::replSettings.pretouch) - log() << "--pretouch " << replset::replSettings.pretouch; + if (repl::replSettings.pretouch) + log() << "--pretouch " << repl::replSettings.pretouch; // Check if we are 32 bit and have not explicitly specified any journaling options if (sizeof(void*) == 4 && !params.count("storage.journal.enabled")) { diff --git a/src/mongo/db/operation_context_impl.cpp b/src/mongo/db/operation_context_impl.cpp index 567f487467c..59a9d8beab4 100644 --- a/src/mongo/db/operation_context_impl.cpp +++ b/src/mongo/db/operation_context_impl.cpp @@ -71,7 +71,7 @@ namespace mongo { bool OperationContextImpl::isPrimaryFor( const StringData& ns ) { string s = ns.toString(); // TODO: fix copy - return replset::isMasterNs(s.c_str()); + return repl::isMasterNs(s.c_str()); } OperationContext* OperationContextImpl::factory() { diff --git a/src/mongo/db/ops/delete_executor.cpp b/src/mongo/db/ops/delete_executor.cpp index 66c26bf8e3d..1a0d3aa19aa 100644 --- a/src/mongo/db/ops/delete_executor.cpp +++ b/src/mongo/db/ops/delete_executor.cpp @@ -110,7 +110,7 @@ namespace mongo { uassert(ErrorCodes::NotMaster, str::stream() << "Not primary while removing from " << ns.ns(), - !logop || replset::isMasterNs(ns.ns().c_str())); + !logop || repl::isMasterNs(ns.ns().c_str())); long long nDeleted = 0; @@ -138,7 +138,7 @@ namespace mongo { if (oldYieldCount != curOp->numYields()) { uassert(ErrorCodes::NotMaster, str::stream() << "No longer primary while removing from " << ns.ns(), - !logop || replset::isMasterNs(ns.ns().c_str())); + !logop || repl::isMasterNs(ns.ns().c_str())); oldYieldCount = curOp->numYields(); } BSONObj toDelete; @@ -158,7 +158,7 @@ namespace mongo { } else { bool replJustOne = true; - replset::logOp(txn, "d", ns.ns().c_str(), toDelete, 0, &replJustOne); + repl::logOp(txn, "d", ns.ns().c_str(), toDelete, 0, &replJustOne); } } diff --git a/src/mongo/db/ops/update.cpp b/src/mongo/db/ops/update.cpp index c1d45a2a890..9a1fd4e7f35 100644 --- a/src/mongo/db/ops/update.cpp +++ b/src/mongo/db/ops/update.cpp @@ -511,7 +511,7 @@ namespace mongo { uassert(ErrorCodes::NotMaster, mongoutils::str::stream() << "Not primary while updating " << nsString.ns(), - !request.shouldCallLogOp() || replset::isMasterNs(nsString.ns().c_str())); + !request.shouldCallLogOp() || repl::isMasterNs(nsString.ns().c_str())); while (true) { // Get next doc, and location @@ -668,7 +668,7 @@ namespace mongo { // Call logOp if requested. if (request.shouldCallLogOp() && !logObj.isEmpty()) { BSONObj idQuery = driver->makeOplogEntryQuery(newObj, request.isMulti()); - replset::logOp(txn, "u", nsString.ns().c_str(), logObj , &idQuery, + repl::logOp(txn, "u", nsString.ns().c_str(), logObj , &idQuery, NULL, request.isFromMigration()); } @@ -782,7 +782,7 @@ namespace mongo { !request.isGod() /*enforceQuota*/); uassertStatusOK(newLoc.getStatus()); if (request.shouldCallLogOp()) { - replset::logOp(txn, "i", nsString.ns().c_str(), newObj, + repl::logOp(txn, "i", nsString.ns().c_str(), newObj, NULL, NULL, request.isFromMigration()); } diff --git a/src/mongo/db/pdfile.cpp b/src/mongo/db/pdfile.cpp index 2898f921ace..8624ab2ee42 100644 --- a/src/mongo/db/pdfile.cpp +++ b/src/mongo/db/pdfile.cpp @@ -132,7 +132,7 @@ namespace mongo { options = b.obj(); } string logNs = nsToDatabase(ns) + ".$cmd"; - replset::logOp(txn, "c", logNs.c_str(), options); + repl::logOp(txn, "c", logNs.c_str(), options); } return Status::OK(); diff --git a/src/mongo/db/prefetch.cpp b/src/mongo/db/prefetch.cpp index 14a1d5a1bd1..7634b2d862a 100644 --- a/src/mongo/db/prefetch.cpp +++ b/src/mongo/db/prefetch.cpp @@ -117,16 +117,16 @@ namespace mongo { void prefetchIndexPages(Collection* collection, const BSONObj& obj) { DiskLoc unusedDl; // unused BSONObjSet unusedKeys; - replset::ReplSetImpl::IndexPrefetchConfig prefetchConfig = - replset::theReplSet->getIndexPrefetchConfig(); + repl::ReplSetImpl::IndexPrefetchConfig prefetchConfig = + repl::theReplSet->getIndexPrefetchConfig(); // do we want prefetchConfig to be (1) as-is, (2) for update ops only, or (3) configured per op type? // One might want PREFETCH_NONE for updates, but it's more rare that it is a bad idea for inserts. // #3 (per op), a big issue would be "too many knobs". switch (prefetchConfig) { - case replset::ReplSetImpl::PREFETCH_NONE: + case repl::ReplSetImpl::PREFETCH_NONE: return; - case replset::ReplSetImpl::PREFETCH_ID_ONLY: + case repl::ReplSetImpl::PREFETCH_ID_ONLY: { TimerHolder timer( &prefetchIndexStats); // on the update op case, the call to prefetchRecordPages will touch the _id index. @@ -144,7 +144,7 @@ namespace mongo { } break; } - case replset::ReplSetImpl::PREFETCH_ALL: + case repl::ReplSetImpl::PREFETCH_ALL: { // indexCount includes all indexes, including ones // in the process of being built diff --git a/src/mongo/db/query/new_find.cpp b/src/mongo/db/query/new_find.cpp index a22eeb31eb5..d78032fed07 100644 --- a/src/mongo/db/query/new_find.cpp +++ b/src/mongo/db/query/new_find.cpp @@ -162,7 +162,7 @@ namespace mongo { // passing in a query object (necessary to check SlaveOK query option), the only state where // reads are allowed is PRIMARY (or master in master/slave). This function uasserts if // reads are not okay. - replset::replVerifyReadsOk(ns, NULL); + repl::replVerifyReadsOk(ns, NULL); // A pin performs a CC lookup and if there is a CC, increments the CC's pin value so it // doesn't time out. Also informs ClientCursor that there is somebody actively holding the @@ -525,7 +525,7 @@ namespace mongo { txn->checkForInterrupt(); // May trigger maxTimeAlwaysTimeOut fail point. // uassert if we are not on a primary, and not a secondary with SlaveOk query parameter set. - replset::replVerifyReadsOk(cq->ns(), &pq); + repl::replVerifyReadsOk(cq->ns(), &pq); // If this exists, the collection is sharded. // If it doesn't exist, we can assume we're not sharded. diff --git a/src/mongo/db/range_deleter_db_env.cpp b/src/mongo/db/range_deleter_db_env.cpp index d3027a3f7ff..0a99f21cc55 100644 --- a/src/mongo/db/range_deleter_db_env.cpp +++ b/src/mongo/db/range_deleter_db_env.cpp @@ -87,7 +87,7 @@ namespace mongo { exclusiveUpper, keyPattern), false, /*maxInclusive*/ - replset::replSet ? secondaryThrottle : false, + repl::replSet ? secondaryThrottle : false, serverGlobalParams.moveParanoia ? &removeSaver : NULL, true, /*fromMigrate*/ true); /*onlyRemoveOrphans*/ @@ -124,10 +124,10 @@ namespace mongo { } } - if (replset::replSet) { + if (repl::replSet) { Timer elapsedTime; ReplTime lastOpApplied = cc().getLastOp().asDate(); - while (!replset::opReplicatedEnough(lastOpApplied, + while (!repl::opReplicatedEnough(lastOpApplied, BSON("w" << "majority").firstElement())) { if (elapsedTime.seconds() >= 3600) { *errMsg = str::stream() << "rangeDeleter timed out after " diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp index 1707baf5d79..6d81029e37f 100644 --- a/src/mongo/db/repl/bgsync.cpp +++ b/src/mongo/db/repl/bgsync.cpp @@ -40,7 +40,7 @@ #include "mongo/db/stats/timer_stats.h" namespace mongo { -namespace replset { +namespace repl { int SleepToAllowBatchingMillis = 2; const int BatchIsSmallish = 40000; // bytes @@ -514,5 +514,5 @@ namespace replset { _assumingPrimary = false; } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/bgsync.h b/src/mongo/db/repl/bgsync.h index cff97b2e923..9539d11aa0f 100644 --- a/src/mongo/db/repl/bgsync.h +++ b/src/mongo/db/repl/bgsync.h @@ -36,7 +36,7 @@ #include "mongo/db/jsobj.h" namespace mongo { -namespace replset { +namespace repl { // This interface exists to facilitate easier testing; // the test infrastructure implements these functions with stubs. @@ -141,5 +141,5 @@ namespace replset { }; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/connections.h b/src/mongo/db/repl/connections.h index ec5eca84816..32836b3d4a1 100644 --- a/src/mongo/db/repl/connections.h +++ b/src/mongo/db/repl/connections.h @@ -39,7 +39,7 @@ #include "mongo/db/repl/rs_config.h" namespace mongo { -namespace replset { +namespace repl { /** here we keep a single connection (with reconnect) for a set of hosts, one each, and allow one user at a time per host. if in use already for that @@ -177,5 +177,5 @@ namespace replset { // Keep trying to connect if we're not yet connected connect(); } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/consensus.cpp b/src/mongo/db/repl/consensus.cpp index 77bde0bcd68..4339e0eb794 100644 --- a/src/mongo/db/repl/consensus.cpp +++ b/src/mongo/db/repl/consensus.cpp @@ -33,7 +33,7 @@ #include "mongo/db/repl/replset_commands.h" namespace mongo { -namespace replset { +namespace repl { /** the first cmd called by a node seeking election and it's a basic sanity test: do any of the nodes it can reach know that it can't be the primary? @@ -488,5 +488,5 @@ namespace replset { } } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/consensus.h b/src/mongo/db/repl/consensus.h index 87ce96c8bb3..0b25bd155f4 100644 --- a/src/mongo/db/repl/consensus.h +++ b/src/mongo/db/repl/consensus.h @@ -37,7 +37,7 @@ #include "mongo/bson/bsonobj.h" namespace mongo { -namespace replset { +namespace repl { class ReplSetImpl; struct Target; @@ -87,5 +87,5 @@ namespace replset { OpTime getElectionTime() const { return _electionTime; } void setElectionTime(OpTime electionTime) { _electionTime = electionTime; } }; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/health.cpp b/src/mongo/db/repl/health.cpp index 420200c9a25..e4695b1d4d3 100644 --- a/src/mongo/db/repl/health.cpp +++ b/src/mongo/db/repl/health.cpp @@ -47,7 +47,7 @@ #include "mongo/util/ramlog.h" namespace mongo { -namespace replset { +namespace repl { /* decls for connections.h */ ScopedConn::M& ScopedConn::_map = *(new ScopedConn::M()); mutex ScopedConn::mapMutex("ScopedConn::mapMutex"); @@ -456,7 +456,7 @@ namespace replset { b.append("set", name()); b.appendTimeT("date", time(0)); b.append("myState", myState.s); - const Member *syncTarget = replset::BackgroundSync::get()->getSyncTarget(); + const Member *syncTarget = repl::BackgroundSync::get()->getSyncTarget(); if ( syncTarget && (myState != MemberState::RS_PRIMARY) && (myState != MemberState::RS_SHUNNED) ) { @@ -466,5 +466,5 @@ namespace replset { if( replSetBlind ) b.append("blind",true); // to avoid confusion if set...normally never set except for testing. } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/health.h b/src/mongo/db/repl/health.h index 64f48a8de21..abee4234f65 100644 --- a/src/mongo/db/repl/health.h +++ b/src/mongo/db/repl/health.h @@ -34,7 +34,7 @@ #include "mongo/logger/tee.h" namespace mongo { -namespace replset { +namespace repl { void fillRsLog(std::stringstream&); @@ -43,5 +43,5 @@ namespace replset { // helper function needed by member.cpp std::string ago(time_t t); -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/heartbeat.cpp b/src/mongo/db/repl/heartbeat.cpp index 245ca56806d..ca692540d9b 100644 --- a/src/mongo/db/repl/heartbeat.cpp +++ b/src/mongo/db/repl/heartbeat.cpp @@ -48,7 +48,7 @@ #include "mongo/util/ramlog.h" namespace mongo { -namespace replset { +namespace repl { using namespace bson; @@ -141,7 +141,7 @@ namespace replset { result.append("hbmsg", theReplSet->hbmsg()); result.append("time", (long long) time(0)); result.appendDate("opTime", theReplSet->lastOpTimeWritten.asDate()); - const Member *syncTarget = replset::BackgroundSync::get()->getSyncTarget(); + const Member *syncTarget = repl::BackgroundSync::get()->getSyncTarget(); if (syncTarget) { result.append("syncingTo", syncTarget->fullName()); } @@ -248,17 +248,17 @@ namespace replset { // this ensures that will have bgsync's s_instance at all points where it is needed // so that we needn't check for its existence - replset::BackgroundSync* sync = replset::BackgroundSync::get(); + repl::BackgroundSync* sync = repl::BackgroundSync::get(); boost::thread t(startSyncThread); - boost::thread producer(stdx::bind(&replset::BackgroundSync::producerThread, sync)); + boost::thread producer(stdx::bind(&repl::BackgroundSync::producerThread, sync)); theReplSet->syncSourceFeedback.go(); // member heartbeats are started in ReplSetImpl::initFromConfig } -} // namespace replset +} // namespace repl } // namespace mongo /* todo: diff --git a/src/mongo/db/repl/heartbeat.h b/src/mongo/db/repl/heartbeat.h index fc8544863d4..73527ec9b9d 100644 --- a/src/mongo/db/repl/heartbeat.h +++ b/src/mongo/db/repl/heartbeat.h @@ -33,7 +33,7 @@ namespace mongo { class BSONObj; -namespace replset { +namespace repl { /* throws */ bool requestHeartbeat(const std::string& setname, @@ -43,5 +43,5 @@ namespace replset { int myConfigVersion, int& theirConfigVersion, bool checkEmpty = false); -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/heartbeat_info.cpp b/src/mongo/db/repl/heartbeat_info.cpp index 083cf31b969..cb362119e6b 100644 --- a/src/mongo/db/repl/heartbeat_info.cpp +++ b/src/mongo/db/repl/heartbeat_info.cpp @@ -33,7 +33,7 @@ #include "mongo/util/fail_point_service.h" namespace mongo { -namespace replset { +namespace repl { unsigned int HeartbeatInfo::numPings; @@ -85,5 +85,5 @@ namespace replset { } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/heartbeat_info.h b/src/mongo/db/repl/heartbeat_info.h index 1718098dcbb..0f2b45963ba 100644 --- a/src/mongo/db/repl/heartbeat_info.h +++ b/src/mongo/db/repl/heartbeat_info.h @@ -35,7 +35,7 @@ #include "mongo/util/concurrency/value.h" namespace mongo { -namespace replset { +namespace repl { /* this is supposed to be just basic information on a member, and copy constructable. */ @@ -82,5 +82,5 @@ namespace replset { unsigned _id; }; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/initial_sync.cpp b/src/mongo/db/repl/initial_sync.cpp index 39d38eb431d..d03bf04f756 100644 --- a/src/mongo/db/repl/initial_sync.cpp +++ b/src/mongo/db/repl/initial_sync.cpp @@ -35,7 +35,7 @@ #include "mongo/db/repl/rs.h" namespace mongo { -namespace replset { +namespace repl { InitialSync::InitialSync(BackgroundSyncInterface *q) : SyncTail(q) {} @@ -58,5 +58,5 @@ namespace replset { return oplogApplySegment(applyGTEObj, minValidObj, multiInitialSyncApply); } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/initial_sync.h b/src/mongo/db/repl/initial_sync.h index a86c61c56c8..3ce40226bab 100644 --- a/src/mongo/db/repl/initial_sync.h +++ b/src/mongo/db/repl/initial_sync.h @@ -31,7 +31,7 @@ #include "mongo/db/repl/sync_tail.h" namespace mongo { -namespace replset { +namespace repl { class BackgroundSyncInterface; @@ -50,5 +50,5 @@ namespace replset { BSONObj oplogApplication(const BSONObj& applyGTEObj, const BSONObj& minValidObj); }; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/is_master.h b/src/mongo/db/repl/is_master.h index 26c32a5d15e..01c78db54ba 100644 --- a/src/mongo/db/repl/is_master.h +++ b/src/mongo/db/repl/is_master.h @@ -36,7 +36,7 @@ #include "mongo/util/mongoutils/str.h" namespace mongo { -namespace replset { +namespace repl { /* We should not allow most operations when not the master also we report not master if we are "dead". @@ -77,5 +77,5 @@ namespace replset { return ns[5] == 0 || ns[5] == '.'; } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/manager.cpp b/src/mongo/db/repl/manager.cpp index 91b0f0eb15e..57b96d4a810 100644 --- a/src/mongo/db/repl/manager.cpp +++ b/src/mongo/db/repl/manager.cpp @@ -36,7 +36,7 @@ #include "mongo/db/client.h" namespace mongo { -namespace replset { +namespace repl { /* check members OTHER THAN US to see if they think they are primary */ const Member * Manager::findOtherPrimary(bool& two) { @@ -289,5 +289,5 @@ namespace replset { busyWithElectSelf = false; } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/manager.h b/src/mongo/db/repl/manager.h index 02b0c7ab7c7..39ef53069b8 100644 --- a/src/mongo/db/repl/manager.h +++ b/src/mongo/db/repl/manager.h @@ -32,7 +32,7 @@ #include "mongo/db/repl/server.h" namespace mongo { -namespace replset { +namespace repl { class Member; class ReplSetImpl; @@ -57,5 +57,5 @@ namespace replset { void msgCheckNewState(); }; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/master_slave.cpp b/src/mongo/db/repl/master_slave.cpp index 30723f48a62..48226902b95 100644 --- a/src/mongo/db/repl/master_slave.cpp +++ b/src/mongo/db/repl/master_slave.cpp @@ -58,7 +58,7 @@ #include "mongo/util/exit.h" namespace mongo { -namespace replset { +namespace repl { void pretouchOperation(const BSONObj& op); void pretouchN(vector&, unsigned a, unsigned b); @@ -1309,5 +1309,5 @@ namespace replset { } } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/master_slave.h b/src/mongo/db/repl/master_slave.h index 37adf66963a..ca21d180111 100644 --- a/src/mongo/db/repl/master_slave.h +++ b/src/mongo/db/repl/master_slave.h @@ -47,7 +47,7 @@ namespace mongo { class Database; class OperationContext; -namespace replset { +namespace repl { // Main entry point for master/slave at startup time. void startMasterSlave(); @@ -185,5 +185,5 @@ namespace replset { std::map< std::string, OpTime > _ignores; }; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/member.cpp b/src/mongo/db/repl/member.cpp index 5d4e6585caa..03d55a0fb3c 100644 --- a/src/mongo/db/repl/member.cpp +++ b/src/mongo/db/repl/member.cpp @@ -33,7 +33,7 @@ namespace mongo { -namespace replset { +namespace repl { using namespace mongoutils::html; @@ -88,5 +88,5 @@ namespace replset { return hbinfo().up() && (config().buildIndexes || !buildIndexes) && state().readable(); } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/member.h b/src/mongo/db/repl/member.h index d05c9fa4d2c..76c958c6456 100644 --- a/src/mongo/db/repl/member.h +++ b/src/mongo/db/repl/member.h @@ -33,7 +33,7 @@ #include "mongo/util/concurrency/list.h" namespace mongo { -namespace replset { +namespace repl { /* member of a replica set */ class Member : public List1::Base { @@ -75,5 +75,5 @@ namespace replset { HeartbeatInfo _hbinfo; }; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/member_state.h b/src/mongo/db/repl/member_state.h index 985d5592fa6..01761d19cf3 100644 --- a/src/mongo/db/repl/member_state.h +++ b/src/mongo/db/repl/member_state.h @@ -31,7 +31,7 @@ #pragma once namespace mongo { -namespace replset { +namespace repl { /* @@ -93,5 +93,5 @@ namespace replset { return ""; } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/multicmd.h b/src/mongo/db/repl/multicmd.h index 6a95e7b6cbf..d07337a0074 100644 --- a/src/mongo/db/repl/multicmd.h +++ b/src/mongo/db/repl/multicmd.h @@ -34,7 +34,7 @@ #include "mongo/util/background.h" namespace mongo { -namespace replset { +namespace repl { struct Target { Target(std::string hostport) : toHost(hostport), ok(false) { } @@ -87,5 +87,5 @@ namespace replset { (*i)->wait(); } } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp index 67588ead947..84a3f3ef336 100644 --- a/src/mongo/db/repl/oplog.cpp +++ b/src/mongo/db/repl/oplog.cpp @@ -65,7 +65,7 @@ #include "mongo/util/startup_test.h" namespace mongo { -namespace replset { +namespace repl { // cached copies of these...so don't rename them, drop them, etc.!!! static Database* localDB = NULL; @@ -151,7 +151,7 @@ namespace replset { theReplSet->lastH = h; ctx.getClient()->setLastOp( ts ); - replset::BackgroundSync::notify(); + repl::BackgroundSync::notify(); } } @@ -773,5 +773,5 @@ namespace replset { setNewOptime(lastOp[ "ts" ].date()); } } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/oplog.h b/src/mongo/db/repl/oplog.h index 675348bfc2e..40803c0a007 100644 --- a/src/mongo/db/repl/oplog.h +++ b/src/mongo/db/repl/oplog.h @@ -34,7 +34,7 @@ namespace mongo { class OperationContext; class OpTime; -namespace replset { +namespace repl { // These functions redefine the function for logOp(), // for either master/slave or replica sets. @@ -113,5 +113,5 @@ namespace replset { * Initializes the global OpTime with the value from the timestamp of the last oplog entry. */ void initOpTimeFromOplog(const std::string& oplogNS); -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/oplogreader.cpp b/src/mongo/db/repl/oplogreader.cpp index 39b31de3d4d..13e1f1519e3 100644 --- a/src/mongo/db/repl/oplogreader.cpp +++ b/src/mongo/db/repl/oplogreader.cpp @@ -45,7 +45,7 @@ #include "mongo/util/log.h" namespace mongo { -namespace replset { +namespace repl { //number of readers created; // this happens when the source source changes, a reconfig/network-error or the cursor dies @@ -189,5 +189,5 @@ namespace replset { tailingQuery(ns, query.done(), fields); } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/oplogreader.h b/src/mongo/db/repl/oplogreader.h index 14fc53edcd9..a60ba2d460c 100644 --- a/src/mongo/db/repl/oplogreader.h +++ b/src/mongo/db/repl/oplogreader.h @@ -38,7 +38,7 @@ namespace mongo { extern const BSONObj reverseNaturalObj; // { $natural : -1 } -namespace replset { +namespace repl { /** * Authenticates conn using the server's cluster-membership credentials. * @@ -165,5 +165,5 @@ namespace replset { bool passthroughHandshake(const mongo::OID& rid, const int f); }; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/repl_reads_ok.cpp b/src/mongo/db/repl/repl_reads_ok.cpp index ac2623eb709..7728210ef2d 100644 --- a/src/mongo/db/repl/repl_reads_ok.cpp +++ b/src/mongo/db/repl/repl_reads_ok.cpp @@ -36,7 +36,7 @@ #include "mongo/util/assert_util.h" namespace mongo { -namespace replset { +namespace repl { /** we allow queries to SimpleSlave's */ void replVerifyReadsOk(const std::string& ns, const LiteParsedQuery* pq) { @@ -63,5 +63,5 @@ namespace replset { } } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/repl_reads_ok.h b/src/mongo/db/repl/repl_reads_ok.h index 825324d6a9c..25ca67d0f25 100644 --- a/src/mongo/db/repl/repl_reads_ok.h +++ b/src/mongo/db/repl/repl_reads_ok.h @@ -34,10 +34,10 @@ namespace mongo { class LiteParsedQuery; -namespace replset { +namespace repl { // Check to see if slaveOk reads are allowed, // based on read preference and query options void replVerifyReadsOk(const std::string& ns, const LiteParsedQuery* pq); -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/repl_set.h b/src/mongo/db/repl/repl_set.h index fea08ef3b5b..914f13751cf 100644 --- a/src/mongo/db/repl/repl_set.h +++ b/src/mongo/db/repl/repl_set.h @@ -32,7 +32,7 @@ #include "mongo/util/concurrency/thread_pool.h" namespace mongo { -namespace replset { +namespace repl { class ReplSet : public ReplSetImpl { public: @@ -97,5 +97,5 @@ namespace replset { ReplSet(); }; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/repl_set_health_poll_task.cpp b/src/mongo/db/repl/repl_set_health_poll_task.cpp index 3e2340e1fd6..9c2b39c1af4 100644 --- a/src/mongo/db/repl/repl_set_health_poll_task.cpp +++ b/src/mongo/db/repl/repl_set_health_poll_task.cpp @@ -37,7 +37,7 @@ #include "mongo/db/repl/rs_config.h" namespace mongo { -namespace replset { +namespace repl { int ReplSetHealthPollTask::s_try_offset = 0; @@ -293,5 +293,5 @@ namespace replset { mem.electionTime = info["electionTime"].Date(); } } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/repl_set_health_poll_task.h b/src/mongo/db/repl/repl_set_health_poll_task.h index 6d239e6e193..5e53e32d56b 100644 --- a/src/mongo/db/repl/repl_set_health_poll_task.h +++ b/src/mongo/db/repl/repl_set_health_poll_task.h @@ -36,7 +36,7 @@ #include "mongo/util/net/hostandport.h" namespace mongo { -namespace replset { +namespace repl { /** * Poll every other set member to check its status. @@ -91,5 +91,5 @@ namespace replset { time_t _timeout; }; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/repl_set_impl.cpp b/src/mongo/db/repl/repl_set_impl.cpp index 3d119df3b5b..b9f76e98e21 100644 --- a/src/mongo/db/repl/repl_set_impl.cpp +++ b/src/mongo/db/repl/repl_set_impl.cpp @@ -44,7 +44,7 @@ #include "mongo/util/exit.h" namespace mongo { -namespace replset { +namespace repl { #ifdef MONGO_PLATFORM_64 const int ReplSetImpl::replWriterThreadCount = 16; const int ReplSetImpl::replPrefetcherThreadCount = 16; @@ -115,7 +115,7 @@ namespace { // Wait for replication to stop and buffer to be consumed LOG(1) << "replSet waiting for replication to finish before becoming primary" << endl; - replset::BackgroundSync::get()->stopReplicationAndFlushBuffer(); + repl::BackgroundSync::get()->stopReplicationAndFlushBuffer(); // Lock here to prevent stepping down & becoming primary from getting interleaved LOG(1) << "replSet waiting for global write lock"; @@ -914,5 +914,5 @@ namespace { return true; } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/repl_set_impl.h b/src/mongo/db/repl/repl_set_impl.h index 6b46d72d4ab..5dd34332c51 100644 --- a/src/mongo/db/repl/repl_set_impl.h +++ b/src/mongo/db/repl/repl_set_impl.h @@ -43,7 +43,7 @@ namespace mongo { class Cloner; -namespace replset { +namespace repl { struct FixUpInfo; class ReplSetCmdline; @@ -281,7 +281,7 @@ namespace replset { private: bool _syncDoInitialSync_clone(Cloner &cloner, const char *master, const list& dbs, bool dataPass); - bool _syncDoInitialSync_applyToHead( replset::SyncTail& syncer, OplogReader* r , + bool _syncDoInitialSync_applyToHead( repl::SyncTail& syncer, OplogReader* r , const Member* source, const BSONObj& lastOp, BSONObj& minValidOut); void _syncDoInitialSync(); @@ -352,5 +352,5 @@ namespace replset { static const char* _initialSyncFlagString; static const BSONObj _initialSyncFlag; }; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/repl_settings.cpp b/src/mongo/db/repl/repl_settings.cpp index 306ad48902c..e8cb54d8728 100644 --- a/src/mongo/db/repl/repl_settings.cpp +++ b/src/mongo/db/repl/repl_settings.cpp @@ -45,7 +45,7 @@ #include "mongo/s/write_ops/batched_command_request.h" namespace mongo { -namespace replset { +namespace repl { // our config from command line etc. @@ -210,5 +210,5 @@ namespace replset { OpCounterServerStatusSection replOpCounterServerStatusSection( "opcountersRepl", &replOpCounters ); -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/repl_settings.h b/src/mongo/db/repl/repl_settings.h index 00ae52f9e78..253d7d9a2d3 100644 --- a/src/mongo/db/repl/repl_settings.h +++ b/src/mongo/db/repl/repl_settings.h @@ -36,7 +36,7 @@ namespace mongo { -namespace replset { +namespace repl { bool anyReplEnabled(); @@ -97,5 +97,5 @@ namespace replset { }; extern ReplSettings replSettings; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/repl_start.cpp b/src/mongo/db/repl/repl_start.cpp index 54655160f88..2a1ffde0d49 100644 --- a/src/mongo/db/repl/repl_start.cpp +++ b/src/mongo/db/repl/repl_start.cpp @@ -39,7 +39,7 @@ #include "mongo/util/log.h" namespace mongo { -namespace replset { +namespace repl { /** @param cfgString /, */ void parseReplsetCmdLine(const std::string& cfgString, @@ -109,5 +109,5 @@ namespace replset { startMasterSlave(); } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/repl_start.h b/src/mongo/db/repl/repl_start.h index 1f621e08b0f..97c688985f5 100644 --- a/src/mongo/db/repl/repl_start.h +++ b/src/mongo/db/repl/repl_start.h @@ -34,7 +34,7 @@ #include "mongo/util/net/hostandport.h" namespace mongo { -namespace replset { +namespace repl { void parseReplsetCmdLine(const std::string& cfgString, std::string& setname, @@ -58,5 +58,5 @@ namespace replset { // This function starts replica set or master/slave replication // based on command line/config parameters. void startReplication(); -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/replset_commands.cpp b/src/mongo/db/repl/replset_commands.cpp index a6f91384b6d..2cba0ca3081 100644 --- a/src/mongo/db/repl/replset_commands.cpp +++ b/src/mongo/db/repl/replset_commands.cpp @@ -43,7 +43,7 @@ using namespace bson; namespace mongo { -namespace replset { +namespace repl { void checkMembersUpForConfigChange(const ReplSetConfig& cfg, BSONObjBuilder& result, bool initial); @@ -83,7 +83,7 @@ namespace replset { } if (cmdObj.hasElement("sethbmsg")) { - replset::sethbmsg(cmdObj["sethbmsg"].String()); + repl::sethbmsg(cmdObj["sethbmsg"].String()); return true; } @@ -453,5 +453,5 @@ namespace replset { } } cmdReplSetUpdatePosition; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/replset_commands.h b/src/mongo/db/repl/replset_commands.h index 25dc174b945..861206e795a 100644 --- a/src/mongo/db/repl/replset_commands.h +++ b/src/mongo/db/repl/replset_commands.h @@ -35,7 +35,7 @@ #include "mongo/db/repl/rs.h" // replSet bool namespace mongo { -namespace replset { +namespace repl { extern bool replSetBlind; extern unsigned replSetForceInitialSyncFailure; @@ -75,5 +75,5 @@ namespace replset { } }; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/replset_web_handler.cpp b/src/mongo/db/repl/replset_web_handler.cpp index 631d4fa3643..f9d271a1e09 100644 --- a/src/mongo/db/repl/replset_web_handler.cpp +++ b/src/mongo/db/repl/replset_web_handler.cpp @@ -36,7 +36,7 @@ #include "mongo/util/mongoutils/str.h" namespace mongo { -namespace replset { +namespace repl { using namespace bson; using namespace mongoutils; @@ -126,5 +126,5 @@ namespace replset { } replSetHandler; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/resync.cpp b/src/mongo/db/repl/resync.cpp index dcd0ec414b5..3bd6b268cdf 100644 --- a/src/mongo/db/repl/resync.cpp +++ b/src/mongo/db/repl/resync.cpp @@ -33,7 +33,7 @@ #include "mongo/db/operation_context_impl.h" namespace mongo { -namespace replset { +namespace repl { // operator requested resynchronization of replication (on a slave or secondary). {resync: 1} class CmdResync : public Command { @@ -118,5 +118,5 @@ namespace replset { return true; } } cmdResync; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/rs.cpp b/src/mongo/db/repl/rs.cpp index f2cba63d3df..d7abe4482ed 100644 --- a/src/mongo/db/repl/rs.cpp +++ b/src/mongo/db/repl/rs.cpp @@ -42,7 +42,7 @@ using namespace std; namespace mongo { -namespace replset { +namespace repl { using namespace bson; @@ -139,7 +139,7 @@ namespace replset { } void ReplSet::shutdown() { - replset::BackgroundSync::shutdown(); + repl::BackgroundSync::shutdown(); } void replLocalAuth() { @@ -205,5 +205,5 @@ namespace replset { } } replIndexPrefetch; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/rs.h b/src/mongo/db/repl/rs.h index ad7841edcb7..efd8d9a52e1 100644 --- a/src/mongo/db/repl/rs.h +++ b/src/mongo/db/repl/rs.h @@ -63,7 +63,7 @@ */ namespace mongo { -namespace replset { +namespace repl { extern bool replSet; // true if using repl sets extern class ReplSet *theReplSet; // null until initialized @@ -110,5 +110,5 @@ namespace replset { return true; } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/rs_base.h b/src/mongo/db/repl/rs_base.h index b8615f46bfd..8896b195aea 100644 --- a/src/mongo/db/repl/rs_base.h +++ b/src/mongo/db/repl/rs_base.h @@ -33,7 +33,7 @@ #include "mongo/util/log.h" namespace mongo { -namespace replset { +namespace repl { /** * most operations on a ReplSet object should be done while locked. that @@ -89,5 +89,5 @@ namespace replset { bool lockedByMe() { return _lockedByMe.get(); } }; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/rs_config.cpp b/src/mongo/db/repl/rs_config.cpp index 13c0967ef74..0e29c52e323 100644 --- a/src/mongo/db/repl/rs_config.cpp +++ b/src/mongo/db/repl/rs_config.cpp @@ -46,7 +46,7 @@ using namespace bson; namespace mongo { -namespace replset { +namespace repl { mongo::mutex ReplSetConfig::groupMx("RS tag group"); const int ReplSetConfig::DEFAULT_HB_TIMEOUT = 10; @@ -759,5 +759,5 @@ namespace replset { LOG(level) << "replSet load config ok from " << (h.isSelf() ? "self" : h.toString()) << rsLog; } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/rs_config.h b/src/mongo/db/repl/rs_config.h index 83c6c47171e..0ec1a44edd4 100644 --- a/src/mongo/db/repl/rs_config.h +++ b/src/mongo/db/repl/rs_config.h @@ -37,7 +37,7 @@ #include "mongo/util/net/hostandport.h" namespace mongo { -namespace replset { +namespace repl { class Member; const std::string rsConfigNs = "local.system.replset"; @@ -327,5 +327,5 @@ namespace replset { }; }; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/rs_exception.h b/src/mongo/db/repl/rs_exception.h index 5e0b70aea71..fcbf2c7d502 100644 --- a/src/mongo/db/repl/rs_exception.h +++ b/src/mongo/db/repl/rs_exception.h @@ -31,7 +31,7 @@ #pragma once namespace mongo { -namespace replset { +namespace repl { class VoteException : public std::exception { public: @@ -43,5 +43,5 @@ namespace replset { const char * what() const throw () { return "RetryAfterSleepException"; } }; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/rs_initialsync.cpp b/src/mongo/db/repl/rs_initialsync.cpp index 7e31ac3e94e..e35b4b6745e 100644 --- a/src/mongo/db/repl/rs_initialsync.cpp +++ b/src/mongo/db/repl/rs_initialsync.cpp @@ -50,7 +50,7 @@ #include "mongo/util/mongoutils/str.h" namespace mongo { -namespace replset { +namespace repl { using namespace mongoutils; using namespace bson; @@ -268,14 +268,14 @@ namespace replset { * @param syncer either initial sync (can reclone missing docs) or "normal" sync (no recloning) * @param r the oplog reader * @param source the sync target - * @param lastOp the op to start syncing at. replset::InitialSync writes this and then moves to - * the queue. replset::SyncTail does not write this, it moves directly to the + * @param lastOp the op to start syncing at. repl::InitialSync writes this and then moves to + * the queue. repl::SyncTail does not write this, it moves directly to the * queue. * @param minValid populated by this function. The most recent op on the sync target's oplog, * this function syncs to this value (inclusive) * @return if applying the oplog succeeded */ - bool ReplSetImpl::_syncDoInitialSync_applyToHead( replset::SyncTail& syncer, OplogReader* r, + bool ReplSetImpl::_syncDoInitialSync_applyToHead( repl::SyncTail& syncer, OplogReader* r, const Member* source, const BSONObj& lastOp , BSONObj& minValid ) { /* our cloned copy will be strange until we apply oplog events that occurred @@ -358,8 +358,8 @@ namespace replset { * closer to the latest op time before it can transition to secondary state. */ void ReplSetImpl::_syncDoInitialSync() { - replset::InitialSync init(replset::BackgroundSync::get()); - replset::SyncTail tail(replset::BackgroundSync::get()); + repl::InitialSync init(repl::BackgroundSync::get()); + repl::SyncTail tail(repl::BackgroundSync::get()); sethbmsg("initial sync pending",0); // if this is the first node, it may have already become primary @@ -488,11 +488,11 @@ namespace replset { // If we just cloned & there were no ops applied, we still want the primary to know where // we're up to - replset::BackgroundSync::notify(); + repl::BackgroundSync::notify(); changeState(MemberState::RS_RECOVERING); sethbmsg("initial sync done",0); } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/rs_initiate.cpp b/src/mongo/db/repl/rs_initiate.cpp index 0c5cb6b2a44..23ec6697a57 100644 --- a/src/mongo/db/repl/rs_initiate.cpp +++ b/src/mongo/db/repl/rs_initiate.cpp @@ -53,7 +53,7 @@ using namespace bson; using namespace mongoutils; namespace mongo { -namespace replset { +namespace repl { /* called on a reconfig AND on initiate throws @@ -299,5 +299,5 @@ namespace replset { } } cmdReplSetInitiate; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/rs_rollback.cpp b/src/mongo/db/repl/rs_rollback.cpp index c621b495156..45b24c899df 100644 --- a/src/mongo/db/repl/rs_rollback.cpp +++ b/src/mongo/db/repl/rs_rollback.cpp @@ -82,7 +82,7 @@ */ namespace mongo { -namespace replset { +namespace repl { using namespace bson; @@ -742,5 +742,5 @@ namespace replset { return 0; } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/rs_sync.cpp b/src/mongo/db/repl/rs_sync.cpp index 85ffc3f7c8f..5baa2017220 100644 --- a/src/mongo/db/repl/rs_sync.cpp +++ b/src/mongo/db/repl/rs_sync.cpp @@ -56,7 +56,7 @@ #include "mongo/util/fail_point_service.h" namespace mongo { -namespace replset { +namespace repl { using namespace bson; @@ -171,7 +171,7 @@ namespace replset { } // record the previous member we were syncing from - const Member *prev = replset::BackgroundSync::get()->getSyncTarget(); + const Member *prev = repl::BackgroundSync::get()->getSyncTarget(); if (prev) { result.append("prevSyncTarget", prev->fullName()); } @@ -227,7 +227,7 @@ namespace replset { } /* we have some data. continue tailing. */ - replset::SyncTail tail(replset::BackgroundSync::get()); + repl::SyncTail tail(repl::BackgroundSync::get()); tail.oplogApplication(); } @@ -301,5 +301,5 @@ namespace replset { changeState(MemberState::RS_RECOVERING); } } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/rs_sync.h b/src/mongo/db/repl/rs_sync.h index 9bb87b59626..26e0906702f 100644 --- a/src/mongo/db/repl/rs_sync.h +++ b/src/mongo/db/repl/rs_sync.h @@ -40,11 +40,11 @@ #include "mongo/util/concurrency/thread_pool.h" namespace mongo { -namespace replset { +namespace repl { // TODO: move hbmsg into an error-keeping class (SERVER-4444) void sethbmsg(const std::string& s, const int logLevel=0); extern int maxSyncSourceLagSecs; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/state_box.h b/src/mongo/db/repl/state_box.h index de9550e092a..8e4a09a78d3 100644 --- a/src/mongo/db/repl/state_box.h +++ b/src/mongo/db/repl/state_box.h @@ -33,7 +33,7 @@ #include "mongo/util/concurrency/rwlock.h" namespace mongo { -namespace replset { +namespace repl { class Member; @@ -92,5 +92,5 @@ namespace replset { RWLock m; SP sp; }; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/sync.cpp b/src/mongo/db/repl/sync.cpp index ce78d279d8e..888edbeb99a 100644 --- a/src/mongo/db/repl/sync.cpp +++ b/src/mongo/db/repl/sync.cpp @@ -42,7 +42,7 @@ #include "mongo/util/log.h" namespace mongo { -namespace replset { +namespace repl { void Sync::setHostname(const string& hostname) { hn = hostname; @@ -136,5 +136,5 @@ namespace replset { return true; } } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/sync.h b/src/mongo/db/repl/sync.h index fc1addcfafa..e86997cad6c 100644 --- a/src/mongo/db/repl/sync.h +++ b/src/mongo/db/repl/sync.h @@ -35,7 +35,7 @@ namespace mongo { class Database; -namespace replset { +namespace repl { class Sync { protected: @@ -52,5 +52,5 @@ namespace replset { void setHostname(const std::string& hostname); }; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/sync_source_feedback.cpp b/src/mongo/db/repl/sync_source_feedback.cpp index b4d7e16af65..9045a069b51 100644 --- a/src/mongo/db/repl/sync_source_feedback.cpp +++ b/src/mongo/db/repl/sync_source_feedback.cpp @@ -40,7 +40,7 @@ #include "mongo/db/operation_context_impl.h" namespace mongo { -namespace replset { +namespace repl { // used in replAuthenticate static const BSONObj userReplQuery = fromjson("{\"user\":\"repl\"}"); @@ -255,7 +255,7 @@ namespace replset { if (state.primary() || state.fatal() || state.startup()) { continue; } - const Member* target = replset::BackgroundSync::get()->getSyncTarget(); + const Member* target = repl::BackgroundSync::get()->getSyncTarget(); if (_syncTarget != target) { _resetConnection(); _syncTarget = target; @@ -287,5 +287,5 @@ namespace replset { } cc().shutdown(); } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/sync_source_feedback.h b/src/mongo/db/repl/sync_source_feedback.h index 8e7587382ca..943d4a14cce 100644 --- a/src/mongo/db/repl/sync_source_feedback.h +++ b/src/mongo/db/repl/sync_source_feedback.h @@ -35,7 +35,7 @@ #include "mongo/util/background.h" namespace mongo { -namespace replset { +namespace repl { class Member; @@ -119,5 +119,5 @@ namespace replset { // used to indicate a connection change which has not yet been shook on bool _handshakeNeeded; }; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp index 8ce9744818b..4526c4af3d3 100644 --- a/src/mongo/db/repl/sync_tail.cpp +++ b/src/mongo/db/repl/sync_tail.cpp @@ -44,7 +44,7 @@ #include "mongo/util/fail_point_service.h" namespace mongo { -namespace replset { +namespace repl { static Counter64 opsAppliedStats; @@ -594,5 +594,5 @@ namespace replset { } } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/sync_tail.h b/src/mongo/db/repl/sync_tail.h index 7f3e4567dc7..581a37498ae 100644 --- a/src/mongo/db/repl/sync_tail.h +++ b/src/mongo/db/repl/sync_tail.h @@ -34,7 +34,7 @@ #include "mongo/db/repl/sync.h" namespace mongo { -namespace replset { +namespace repl { class BackgroundSyncInterface; @@ -138,5 +138,5 @@ namespace replset { void multiSyncApply(const std::vector& ops, SyncTail* st); void multiInitialSyncApply(const std::vector& ops, SyncTail* st); -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/topology_coordinator.h b/src/mongo/db/repl/topology_coordinator.h index c384b27b8d5..ac5f3d45e73 100644 --- a/src/mongo/db/repl/topology_coordinator.h +++ b/src/mongo/db/repl/topology_coordinator.h @@ -37,7 +37,7 @@ namespace mongo { class OpTime; -namespace replset { +namespace repl { class HeartbeatInfo; class Member; @@ -116,5 +116,5 @@ namespace replset { protected: TopologyCoordinator() {} }; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/topology_coordinator_impl.cpp b/src/mongo/db/repl/topology_coordinator_impl.cpp index 4bbef351245..96fc05bfd72 100644 --- a/src/mongo/db/repl/topology_coordinator_impl.cpp +++ b/src/mongo/db/repl/topology_coordinator_impl.cpp @@ -32,7 +32,7 @@ #include "mongo/db/repl/rs_sync.h" // maxSyncSourceLagSecs namespace mongo { -namespace replset { +namespace repl { TopologyCoordinatorImpl::TopologyCoordinatorImpl() : _majorityNumber(0) { @@ -263,5 +263,5 @@ namespace replset { } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/topology_coordinator_impl.h b/src/mongo/db/repl/topology_coordinator_impl.h index 0acd55d8ad9..a08bdfdec2a 100644 --- a/src/mongo/db/repl/topology_coordinator_impl.h +++ b/src/mongo/db/repl/topology_coordinator_impl.h @@ -37,7 +37,7 @@ #include "mongo/util/concurrency/list.h" namespace mongo { -namespace replset { +namespace repl { class TagSubgroup; @@ -184,5 +184,5 @@ namespace replset { }; -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/write_concern.cpp b/src/mongo/db/repl/write_concern.cpp index ed7b2f09250..11c8d3c8252 100644 --- a/src/mongo/db/repl/write_concern.cpp +++ b/src/mongo/db/repl/write_concern.cpp @@ -44,7 +44,7 @@ #define REPLDEBUG(x) namespace mongo { -namespace replset { +namespace repl { using namespace mongoutils; @@ -365,5 +365,5 @@ namespace replset { unsigned getSlaveCount() { return slaveTracking.getSlaveCount(); } -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/write_concern.h b/src/mongo/db/repl/write_concern.h index b9ec0b1ce8c..f6b55955e4c 100644 --- a/src/mongo/db/repl/write_concern.h +++ b/src/mongo/db/repl/write_concern.h @@ -40,7 +40,7 @@ namespace mongo { class CurOp; -namespace replset { +namespace repl { bool updateSlaveLocations(BSONArray optimes); @@ -57,5 +57,5 @@ namespace replset { void resetSlaveCache(); unsigned getSlaveCount(); -} // namespace replset +} // namespace repl } // namespace mongo diff --git a/src/mongo/db/restapi.cpp b/src/mongo/db/restapi.cpp index ea03837d429..1e9e2708efa 100644 --- a/src/mongo/db/restapi.cpp +++ b/src/mongo/db/restapi.cpp @@ -277,17 +277,17 @@ namespace mongo { ss << "# databases: " << dbHolder().sizeInfo() << '\n'; ss << "# Cursors: " << ClientCursor::totalOpen() << '\n'; ss << "replication: "; - if (*replset::replInfo) - ss << "\nreplInfo: " << replset::replInfo << "\n\n"; - if (replset::replSet) { + if (*repl::replInfo) + ss << "\nreplInfo: " << repl::replInfo << "\n\n"; + if (repl::replSet) { ss << a("", "see replSetGetStatus link top of page") << "--replSet " - << replset::replSettings.replSet; + << repl::replSettings.replSet; } - if (replset::replAllDead) - ss << "\nreplication replAllDead=" << replset::replAllDead << "\n"; + if (repl::replAllDead) + ss << "\nreplication replAllDead=" << repl::replAllDead << "\n"; else { - ss << "\nmaster: " << replset::replSettings.master << '\n'; - ss << "slave: " << replset::replSettings.slave << '\n'; + ss << "\nmaster: " << repl::replSettings.master << '\n'; + ss << "slave: " << repl::replSettings.slave << '\n'; ss << '\n'; } diff --git a/src/mongo/db/ttl.cpp b/src/mongo/db/ttl.cpp index 2572b5ff1a2..be47f16d3d3 100644 --- a/src/mongo/db/ttl.cpp +++ b/src/mongo/db/ttl.cpp @@ -67,7 +67,7 @@ namespace mongo { void doTTLForDB( const string& dbName ) { - if (!replset::isMasterNs(dbName.c_str())) + if (!repl::isMasterNs(dbName.c_str())) return; vector indexes; @@ -122,7 +122,7 @@ namespace mongo { continue; } - if (!replset::isMasterNs(dbName.c_str())) { + if (!repl::isMasterNs(dbName.c_str())) { // we've stepped down since we started this function, // so we should stop working as we only do deletes on the primary break; @@ -166,7 +166,7 @@ namespace mongo { } // if part of replSet but not in a readable state (e.g. during initial sync), skip. - if (replset::theReplSet && !replset::theReplSet->state().readable()) + if (repl::theReplSet && !repl::theReplSet->state().readable()) continue; set dbs; diff --git a/src/mongo/db/write_concern.cpp b/src/mongo/db/write_concern.cpp index 596a582595f..e2975ff103f 100644 --- a/src/mongo/db/write_concern.cpp +++ b/src/mongo/db/write_concern.cpp @@ -53,8 +53,8 @@ namespace mongo { } const bool isConfigServer = serverGlobalParams.configsvr; - const bool isMasterSlaveNode = replset::anyReplEnabled() && !replset::theReplSet; - const bool isReplSetNode = replset::anyReplEnabled() && replset::theReplSet; + const bool isMasterSlaveNode = repl::anyReplEnabled() && !repl::theReplSet; + const bool isReplSetNode = repl::anyReplEnabled() && repl::theReplSet; if ( isConfigServer || ( !isMasterSlaveNode && !isReplSetNode ) ) { @@ -167,12 +167,12 @@ namespace mongo { return Status::OK(); } - if (!replset::anyReplEnabled() || serverGlobalParams.configsvr) { + if (!repl::anyReplEnabled() || serverGlobalParams.configsvr) { // no replication check needed (validated above) return Status::OK(); } - const bool isMasterSlaveNode = replset::anyReplEnabled() && !replset::theReplSet; + const bool isMasterSlaveNode = repl::anyReplEnabled() && !repl::theReplSet; if ( writeConcern.wMode == "majority" && isMasterSlaveNode ) { // with master/slave, majority is equivalent to w=1 return Status::OK(); @@ -189,11 +189,11 @@ namespace mongo { while ( 1 ) { if ( writeConcern.wNumNodes > 0 ) { - if (replset::opReplicatedEnough(replOpTime, writeConcern.wNumNodes)) { + if (repl::opReplicatedEnough(replOpTime, writeConcern.wNumNodes)) { break; } } - else if (replset::opReplicatedEnough(replOpTime, writeConcern.wMode)) { + else if (repl::opReplicatedEnough(replOpTime, writeConcern.wMode)) { break; } @@ -217,7 +217,7 @@ namespace mongo { } // Add stats - result->writtenTo = replset::getHostsWrittenTo(replOpTime); + result->writtenTo = repl::getHostsWrittenTo(replOpTime); result->wTime = gleTimerHolder.recordMillis(); return replStatus; diff --git a/src/mongo/dbtests/framework_options.cpp b/src/mongo/dbtests/framework_options.cpp index 044fb8f1cb3..4a9a97a4914 100644 --- a/src/mongo/dbtests/framework_options.cpp +++ b/src/mongo/dbtests/framework_options.cpp @@ -191,7 +191,7 @@ namespace mongo { storageGlobalParams.dur = true; } - replset::replSettings.oplogSize = 10 * 1024 * 1024; + repl::replSettings.oplogSize = 10 * 1024 * 1024; DEV log() << "_DEBUG build" << endl; if( sizeof(void*)==4 ) diff --git a/src/mongo/dbtests/mock/mock_replica_set.cpp b/src/mongo/dbtests/mock/mock_replica_set.cpp index 571a30129a7..ea9d12b928d 100644 --- a/src/mongo/dbtests/mock/mock_replica_set.cpp +++ b/src/mongo/dbtests/mock/mock_replica_set.cpp @@ -53,7 +53,7 @@ namespace mongo { MockConnRegistry::get()->addServer(mockServer); - replset::ReplSetConfig::MemberCfg config; + repl::ReplSetConfig::MemberCfg config; config.h = HostAndPort(hostName); replConfig.insert(std::make_pair(hostName, config)); } @@ -110,7 +110,7 @@ namespace mongo { ReplConfigMap::const_iterator iter = _replConfig.find(hostAndPort); fassert(16578, iter != _replConfig.end()); - const replset::ReplSetConfig::MemberCfg& config = iter->second; + const repl::ReplSetConfig::MemberCfg& config = iter->second; fassert(16579, !config.hidden && config.priority > 0 && !config.arbiterOnly); _primaryHost = hostAndPort; @@ -201,7 +201,7 @@ namespace mongo { builder.append("primary", getPrimary()); - const replset::ReplSetConfig::MemberCfg& replConfig = configIter->second; + const repl::ReplSetConfig::MemberCfg& replConfig = configIter->second; if (replConfig.arbiterOnly) { builder.append("arbiterOnly", true); } @@ -242,13 +242,13 @@ namespace mongo { int MockReplicaSet::getState(const std::string& hostAndPort) const { if (_replConfig.count(hostAndPort) < 1) { - return static_cast(replset::MemberState::RS_SHUNNED); + return static_cast(repl::MemberState::RS_SHUNNED); } else if (hostAndPort == getPrimary()) { - return static_cast(replset::MemberState::RS_PRIMARY); + return static_cast(repl::MemberState::RS_PRIMARY); } else { - return static_cast(replset::MemberState::RS_SECONDARY); + return static_cast(repl::MemberState::RS_SECONDARY); } } diff --git a/src/mongo/dbtests/mock/mock_replica_set.h b/src/mongo/dbtests/mock/mock_replica_set.h index fe29f791e88..92f238cd1b7 100644 --- a/src/mongo/dbtests/mock/mock_replica_set.h +++ b/src/mongo/dbtests/mock/mock_replica_set.h @@ -49,7 +49,7 @@ namespace mongo { */ class MockReplicaSet { public: - typedef std::map ReplConfigMap; + typedef std::map ReplConfigMap; /** * Creates a mock replica set and automatically mocks the isMaster diff --git a/src/mongo/dbtests/replsettests.cpp b/src/mongo/dbtests/replsettests.cpp index 3742e5683b7..da37f47dd2e 100644 --- a/src/mongo/dbtests/replsettests.cpp +++ b/src/mongo/dbtests/replsettests.cpp @@ -48,10 +48,10 @@ namespace ReplSetTests { const int replWriterThreadCount(32); const int replPrefetcherThreadCount(32); - class ReplSetTest : public mongo::replset::ReplSet { - mongo::replset::ReplSetConfig *_config; - mongo::replset::ReplSetConfig::MemberCfg *_myConfig; - mongo::replset::BackgroundSyncInterface *_syncTail; + class ReplSetTest : public mongo::repl::ReplSet { + mongo::repl::ReplSetConfig *_config; + mongo::repl::ReplSetConfig::MemberCfg *_myConfig; + mongo::repl::BackgroundSyncInterface *_syncTail; public: static const int replWriterThreadCount; static const int replPrefetcherThreadCount; @@ -60,7 +60,7 @@ namespace ReplSetTests { ret->init(); // we need to get() the BackgroundSync so that it has its s_instance initialized // since applyOps() eventually calls notify() which makes use of the s_instance - mongo::replset::BackgroundSync::get(); + mongo::repl::BackgroundSync::get(); return ret.release(); } virtual ~ReplSetTest() { @@ -76,16 +76,16 @@ namespace ReplSetTests { virtual bool tryToGoLiveAsASecondary(OpTime& minvalid) { return false; } - virtual const mongo::replset::ReplSetConfig& config() { + virtual const mongo::repl::ReplSetConfig& config() { return *_config; } - virtual const mongo::replset::ReplSetConfig::MemberCfg& myConfig() { + virtual const mongo::repl::ReplSetConfig::MemberCfg& myConfig() { return *_myConfig; } virtual bool buildIndexes() const { return true; } - void setSyncTail(replset::BackgroundSyncInterface *syncTail) { + void setSyncTail(repl::BackgroundSyncInterface *syncTail) { _syncTail = syncTail; } private: @@ -95,13 +95,13 @@ namespace ReplSetTests { void init() { BSONArrayBuilder members; members.append(BSON("_id" << 0 << "host" << "host1")); - _config = mongo::replset::ReplSetConfig::make(BSON("_id" << "foo" + _config = mongo::repl::ReplSetConfig::make(BSON("_id" << "foo" << "members" << members.arr())); - _myConfig = new mongo::replset::ReplSetConfig::MemberCfg(); + _myConfig = new mongo::repl::ReplSetConfig::MemberCfg(); } }; - class BackgroundSyncTest : public replset::BackgroundSyncInterface { + class BackgroundSyncTest : public repl::BackgroundSyncInterface { std::queue _queue; public: BackgroundSyncTest() {} @@ -116,7 +116,7 @@ namespace ReplSetTests { virtual void consume() { _queue.pop(); } - virtual mongo::replset::Member* getSyncTarget() { + virtual mongo::repl::Member* getSyncTarget() { return 0; } void addDoc(BSONObj doc) { @@ -133,7 +133,7 @@ namespace ReplSetTests { static DBDirectClient client_; protected: static BackgroundSyncTest* _bgsync; - static replset::SyncTail* _tailer; + static repl::SyncTail* _tailer; public: Base() { } @@ -186,30 +186,30 @@ namespace ReplSetTests { db->dropCollection(&txn, ns()); } static void setup() { - mongo::replset::replSettings.replSet = "foo"; - mongo::replset::replSettings.oplogSize = 5 * 1024 * 1024; - mongo::replset::createOplog(); + mongo::repl::replSettings.replSet = "foo"; + mongo::repl::replSettings.oplogSize = 5 * 1024 * 1024; + mongo::repl::createOplog(); // setup background sync instance _bgsync = new BackgroundSyncTest(); // setup tail - _tailer = new replset::SyncTail(_bgsync); + _tailer = new repl::SyncTail(_bgsync); // setup theReplSet ReplSetTest *rst = ReplSetTest::make(); rst->setSyncTail(_bgsync); - delete replset::theReplSet; - replset::theReplSet = rst; + delete repl::theReplSet; + repl::theReplSet = rst; } }; DBDirectClient Base::client_; BackgroundSyncTest* Base::_bgsync = NULL; - replset::SyncTail* Base::_tailer = NULL; + repl::SyncTail* Base::_tailer = NULL; - class MockInitialSync : public replset::InitialSync { + class MockInitialSync : public repl::InitialSync { int step; public: MockInitialSync() : InitialSync(0), step(0), failOnStep(SUCCEED), retry(true) {} @@ -250,19 +250,19 @@ namespace ReplSetTests { // all three should succeed std::vector ops; ops.push_back(obj); - replset::multiInitialSyncApply(ops, &mock); + repl::multiInitialSyncApply(ops, &mock); mock.failOnStep = MockInitialSync::FAIL_FIRST_APPLY; - replset::multiInitialSyncApply(ops, &mock); + repl::multiInitialSyncApply(ops, &mock); mock.retry = false; - replset::multiInitialSyncApply(ops, &mock); + repl::multiInitialSyncApply(ops, &mock); drop(); } }; - class SyncTest2 : public replset::InitialSync { + class SyncTest2 : public repl::InitialSync { public: bool insertOnRetry; SyncTest2() : InitialSync(0), insertOnRetry(false) {} @@ -359,7 +359,7 @@ namespace ReplSetTests { Client::Context ctx( _cappedNs ); OperationContextImpl txn; // in an annoying twist of api, returns true on failure - return !mongo::replset::applyOperation_inlock(&txn, ctx.db(), op, true); + return !mongo::repl::applyOperation_inlock(&txn, ctx.db(), op, true); } void run() { @@ -367,7 +367,7 @@ namespace ReplSetTests { BSONObj op = updateFail(); - mongo::replset::Sync s(""); + mongo::repl::Sync s(""); verify(!s.shouldRetry(op)); } }; @@ -527,7 +527,7 @@ namespace ReplSetTests { void run() { const int expected = 100; - replset::theReplSet->syncSourceFeedback.ensureMe(); + repl::theReplSet->syncSourceFeedback.ensureMe(); drop(); addInserts(100); diff --git a/src/mongo/dbtests/repltests.cpp b/src/mongo/dbtests/repltests.cpp index 9f034cdaf18..9dbf6a3fa17 100644 --- a/src/mongo/dbtests/repltests.cpp +++ b/src/mongo/dbtests/repltests.cpp @@ -58,11 +58,11 @@ namespace ReplTests { mutable OperationContextImpl _txn; public: Base() : _context( ns() ) { - mongo::replset::oldRepl(); - mongo::replset::replSettings.replSet = ""; - mongo::replset::replSettings.oplogSize = 5 * 1024 * 1024; - mongo::replset::replSettings.master = true; - mongo::replset::createOplog(); + mongo::repl::oldRepl(); + mongo::repl::replSettings.replSet = ""; + mongo::repl::replSettings.oplogSize = 5 * 1024 * 1024; + mongo::repl::replSettings.master = true; + mongo::repl::createOplog(); Collection* c = _context.db()->getCollection( ns() ); if ( ! c ) { @@ -72,7 +72,7 @@ namespace ReplTests { } ~Base() { try { - mongo::replset::replSettings.master = false; + mongo::repl::replSettings.master = false; deleteAll( ns() ); deleteAll( cllNS() ); } @@ -170,7 +170,7 @@ namespace ReplTests { BSONObjBuilder b; b.append("host", "localhost"); b.appendTimestamp("syncedTo", 0); - mongo::replset::ReplSource a(b.obj()); + mongo::repl::ReplSource a(b.obj()); for( vector< BSONObj >::iterator i = ops.begin(); i != ops.end(); ++i ) { if ( 0 ) { mongo::unittest::log() << "op: " << *i << endl; @@ -1336,7 +1336,7 @@ namespace ReplTests { class DatabaseIgnorerBasic { public: void run() { - mongo::replset::DatabaseIgnorer d; + mongo::repl::DatabaseIgnorer d; ASSERT( !d.ignoreAt( "a", OpTime( 4, 0 ) ) ); d.doIgnoreUntilAfter( "a", OpTime( 5, 0 ) ); ASSERT( d.ignoreAt( "a", OpTime( 4, 0 ) ) ); @@ -1352,7 +1352,7 @@ namespace ReplTests { class DatabaseIgnorerUpdate { public: void run() { - mongo::replset::DatabaseIgnorer d; + mongo::repl::DatabaseIgnorer d; d.doIgnoreUntilAfter( "a", OpTime( 5, 0 ) ); d.doIgnoreUntilAfter( "a", OpTime( 6, 0 ) ); ASSERT( d.ignoreAt( "a", OpTime( 5, 5 ) ) ); @@ -1373,7 +1373,7 @@ namespace ReplTests { class ReplSetMemberCfgEquality : public Base { public: void run() { - mongo::replset::ReplSetConfig::MemberCfg m1, m2; + mongo::repl::ReplSetConfig::MemberCfg m1, m2; verify(m1 == m2); m1.tags["x"] = "foo"; verify(m1 != m2); @@ -1388,10 +1388,10 @@ namespace ReplTests { } }; - class SyncTest : public mongo::replset::Sync { + class SyncTest : public mongo::repl::Sync { public: bool returnEmpty; - SyncTest() : mongo::replset::Sync(""), returnEmpty(false) {} + SyncTest() : mongo::repl::Sync(""), returnEmpty(false) {} virtual ~SyncTest() {} virtual BSONObj getMissingDoc(Database* db, const BSONObj& o) { if (returnEmpty) { @@ -1410,7 +1410,7 @@ namespace ReplTests { // this should fail because we can't connect try { - mongo::replset::Sync badSource("localhost:123"); + mongo::repl::Sync badSource("localhost:123"); badSource.getMissingDoc(db(), o); } catch (DBException&) { diff --git a/src/mongo/s/d_migrate.cpp b/src/mongo/s/d_migrate.cpp index aa485c4e343..e0c8a6f5bca 100644 --- a/src/mongo/s/d_migrate.cpp +++ b/src/mongo/s/d_migrate.cpp @@ -805,15 +805,15 @@ namespace mongo { // if we do a w=2 after every write bool secondaryThrottle = cmdObj["secondaryThrottle"].trueValue(); if ( secondaryThrottle ) { - if (replset::theReplSet) { - if (replset::theReplSet->config().getMajority() <= 1) { + if (repl::theReplSet) { + if (repl::theReplSet->config().getMajority() <= 1) { secondaryThrottle = false; warning() << "not enough nodes in set to use secondaryThrottle: " - << " majority: " << replset::theReplSet->config().getMajority() + << " majority: " << repl::theReplSet->config().getMajority() << endl; } } - else if (!replset::anyReplEnabled() ) { + else if (!repl::anyReplEnabled() ) { secondaryThrottle = false; warning() << "secondaryThrottle selected but no replication" << endl; } @@ -1602,8 +1602,8 @@ namespace mongo { verify( ! min.isEmpty() ); verify( ! max.isEmpty() ); - replSetMajorityCount = replset::theReplSet ? - replset::theReplSet->config().getMajority() : 0; + replSetMajorityCount = repl::theReplSet ? + repl::theReplSet->config().getMajority() : 0; log() << "starting receiving-end of migration of chunk " << min << " -> " << max << " for collection " << ns << " from " << from @@ -1673,7 +1673,7 @@ namespace mongo { } // make sure to create index on secondaries as well - replset::logOp(txn, "i", db->getSystemIndexesName().c_str(), idx, + repl::logOp(txn, "i", db->getSystemIndexesName().c_str(), idx, NULL, NULL, true /* fromMigrate */); } @@ -1771,7 +1771,7 @@ namespace mongo { clonedBytes += o.objsize(); if ( secondaryThrottle && thisTime > 0 ) { - if (!replset::waitForReplication(cc().getLastOp(), + if (!repl::waitForReplication(cc().getLastOp(), 2, 60 /* seconds to wait */)) { warning() << "secondaryThrottle on, but doc insert timed out after 60 seconds, continuing" << endl; } @@ -2027,7 +2027,7 @@ namespace mongo { // if replication is on, try to force enough secondaries to catch up // TODO opReplicatedEnough should eventually honor priorities and geo-awareness // for now, we try to replicate to a sensible number of secondaries - return replset::opReplicatedEnough(lastOpApplied, replSetMajorityCount); + return repl::opReplicatedEnough(lastOpApplied, replSetMajorityCount); } bool flushPendingWrites( const ReplTime& lastOpApplied ) { @@ -2230,7 +2230,7 @@ namespace mongo { migrateStatus.shardKeyPattern = keya.getOwned(); } - if (migrateStatus.secondaryThrottle && ! replset::anyReplEnabled()) { + if (migrateStatus.secondaryThrottle && ! repl::anyReplEnabled()) { warning() << "secondaryThrottle asked for, but not replication" << endl; migrateStatus.secondaryThrottle = false; } diff --git a/src/mongo/s/d_state.cpp b/src/mongo/s/d_state.cpp index c5c36de789e..c70ca52ea55 100644 --- a/src/mongo/s/d_state.cpp +++ b/src/mongo/s/d_state.cpp @@ -982,7 +982,7 @@ namespace mongo { } // we can run on a slave up to here - if (!replset::_isMaster()) { + if (!repl::_isMaster()) { result.append( "errmsg" , "not master" ); result.append( "note" , "from post init in setShardVersion" ); return false; @@ -1259,7 +1259,7 @@ namespace mongo { if ( ! shardingState.enabled() ) return true; - if (!replset::isMasterNs(ns.c_str())) { + if (!repl::isMasterNs(ns.c_str())) { // right now connections to secondaries aren't versioned at all return true; } diff --git a/src/mongo/tools/oplog.cpp b/src/mongo/tools/oplog.cpp index fc5bb95860f..a4bffb75135 100644 --- a/src/mongo/tools/oplog.cpp +++ b/src/mongo/tools/oplog.cpp @@ -53,7 +53,7 @@ public: toolInfoLog() << "going to connect" << std::endl; - replset::OplogReader r; + repl::OplogReader r; r.setTailingQueryOptions( QueryOption_SlaveOk | QueryOption_AwaitData ); r.connect(mongoOplogGlobalParams.from); -- cgit v1.2.1