summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/rs.cpp
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2014-07-17 17:03:15 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2014-07-18 15:16:14 -0400
commit3c3d656668e26645492ee3dafb241631352426d4 (patch)
treef69bcbf52ad1ef98aba01cdcb61b86f44e34d4ca /src/mongo/db/repl/rs.cpp
parent848999f1527e8390d4d76f9fad0860218b73be4d (diff)
downloadmongo-3c3d656668e26645492ee3dafb241631352426d4.tar.gz
SERVER-13961 Cleanup some nested instantiations of OperationContextImpl in repl
These are causing deadlocks if LockState is removed from TLS because of pseudo-conflicting locks on the same code path.
Diffstat (limited to 'src/mongo/db/repl/rs.cpp')
-rw-r--r--src/mongo/db/repl/rs.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/mongo/db/repl/rs.cpp b/src/mongo/db/repl/rs.cpp
index a007b80f66d..ed2f98329c7 100644
--- a/src/mongo/db/repl/rs.cpp
+++ b/src/mongo/db/repl/rs.cpp
@@ -34,6 +34,7 @@
#include "mongo/db/audit.h"
#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/client.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/db/repl/bgsync.h"
#include "mongo/db/repl/connections.h"
#include "mongo/db/repl/repl_set_impl.h"
@@ -57,21 +58,21 @@ namespace repl {
ReplSet::ReplSet() {
}
- ReplSet* ReplSet::make(ReplSetSeedList& replSetSeedList) {
+ ReplSet* ReplSet::make(OperationContext* txn, ReplSetSeedList& replSetSeedList) {
auto_ptr<ReplSet> ret(new ReplSet());
- ret->init(replSetSeedList);
+ ret->init(txn, replSetSeedList);
return ret.release();
}
ReplSetImpl::StartupStatus ReplSetImpl::startupStatus = PRESTART;
DiagStr ReplSetImpl::startupStatusMsg;
- void ReplSet::haveNewConfig(ReplSetConfig& newConfig, bool addComment) {
+ void ReplSet::haveNewConfig(OperationContext* txn, ReplSetConfig& newConfig, bool addComment) {
bo comment;
if( addComment )
comment = BSON( "msg" << "Reconfig set" << "version" << newConfig.version );
- newConfig.saveConfigLocally(comment);
+ newConfig.saveConfigLocally(txn, comment);
try {
BSONObj oldConfForAudit = config().asBson();
@@ -79,7 +80,7 @@ namespace repl {
audit::logReplSetReconfig(ClientBasic::getCurrent(),
&oldConfForAudit,
&newConfForAudit);
- if (initFromConfig(newConfig, true)) {
+ if (initFromConfig(txn, newConfig, true)) {
log() << "replSet replSetReconfig new config saved locally" << rsLog;
}
}
@@ -94,10 +95,12 @@ namespace repl {
}
void Manager::msgReceivedNewConfig(BSONObj o) {
+ OperationContextImpl txn;
+
log() << "replset msgReceivedNewConfig version: " << o["version"].toString() << rsLog;
scoped_ptr<ReplSetConfig> config(ReplSetConfig::make(o));
if( config->version > rs->config().version )
- theReplSet->haveNewConfig(*config, false);
+ theReplSet->haveNewConfig(&txn, *config, false);
else {
log() << "replSet info msgReceivedNewConfig but version isn't higher " <<
config->version << ' ' << rs->config().version << rsLog;
@@ -111,13 +114,15 @@ namespace repl {
*/
void startReplSets(ReplSetSeedList *replSetSeedList) {
Client::initThread("rsStart");
+ OperationContextImpl txn;
+
try {
verify( theReplSet == 0 );
if( replSetSeedList == 0 ) {
return;
}
replLocalAuth();
- (theReplSet = ReplSet::make(*replSetSeedList))->go();
+ (theReplSet = ReplSet::make(&txn, *replSetSeedList))->go();
}
catch(std::exception& e) {
log() << "replSet caught exception in startReplSets thread: " << e.what() << rsLog;