summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/resync.cpp
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2014-05-28 13:49:34 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2014-06-02 22:52:46 -0400
commit8c9fcc939f9f1a2b593e606bd790cc87efd4064f (patch)
treebeaa313f3e53cf72ca76aa5392946b97736ea6b3 /src/mongo/db/repl/resync.cpp
parent4add46aa8dd05a5c6d8af2c798eef6e9b5e4164b (diff)
downloadmongo-8c9fcc939f9f1a2b593e606bd790cc87efd4064f.tar.gz
SERVER-13961 Start using LockState from the OperationContext
Diffstat (limited to 'src/mongo/db/repl/resync.cpp')
-rw-r--r--src/mongo/db/repl/resync.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/mongo/db/repl/resync.cpp b/src/mongo/db/repl/resync.cpp
index 3bd6b268cdf..d1c693d4b92 100644
--- a/src/mongo/db/repl/resync.cpp
+++ b/src/mongo/db/repl/resync.cpp
@@ -67,7 +67,7 @@ namespace repl {
bool fromRepl) {
const std::string ns = parseNs(dbname, cmdObj);
- Lock::GlobalWrite globalWriteLock;
+ Lock::GlobalWrite globalWriteLock(txn->lockState());
Client::Context ctx(ns);
if (replSettings.usingReplSets()) {
if (!theReplSet) {
@@ -83,7 +83,7 @@ namespace repl {
// below this comment pertains only to master/slave replication
if ( cmdObj.getBoolField( "force" ) ) {
- if ( !waitForSyncToFinish( errmsg ) )
+ if ( !waitForSyncToFinish(txn, errmsg ) )
return false;
replAllDead = "resync forced";
}
@@ -91,14 +91,15 @@ namespace repl {
errmsg = "not dead, no need to resync";
return false;
}
- if ( !waitForSyncToFinish( errmsg ) )
+ if ( !waitForSyncToFinish(txn, errmsg ) )
return false;
ReplSource::forceResyncDead( txn, "client" );
result.append( "info", "triggered resync for all sources" );
return true;
}
- bool waitForSyncToFinish( string &errmsg ) const {
+
+ bool waitForSyncToFinish(OperationContext* txn, string &errmsg) const {
// Wait for slave thread to finish syncing, so sources will be be
// reloaded with new saved state on next pass.
Timer t;
@@ -106,7 +107,7 @@ namespace repl {
if ( syncing == 0 || t.millis() > 30000 )
break;
{
- Lock::TempRelease t;
+ Lock::TempRelease t(txn->lockState());
relinquishSyncingSome = 1;
sleepmillis(1);
}