diff options
author | Aaron <aaron@10gen.com> | 2010-06-29 20:57:51 -0700 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2010-06-29 20:57:51 -0700 |
commit | 3ef75220fcb41f767a1868cf12a91baf975ff7e2 (patch) | |
tree | eb96c3b810e5a0be2f40517f215aec4191b9b851 | |
parent | 60a3995b7573a13ee699972c03edc0e9bd2adf76 (diff) | |
download | mongo-3ef75220fcb41f767a1868cf12a91baf975ff7e2.tar.gz |
SERVER-1324 scan while locked more carefully
-rw-r--r-- | db/repl.cpp | 8 | ||||
-rw-r--r-- | db/repl.h | 3 |
2 files changed, 6 insertions, 5 deletions
diff --git a/db/repl.cpp b/db/repl.cpp index efb078b3ac3..0d12b924fa2 100644 --- a/db/repl.cpp +++ b/db/repl.cpp @@ -927,7 +927,7 @@ namespace mongo { dblock lk; if ( localLogTail && replPair && replPair->state == ReplPair::State_Master ) { - updateSetsWithLocalOps( *localLogTail, true ); // allow unlocking + while( updateSetsWithLocalOps( *localLogTail, true ) > 0 ); // allow unlocking updateSetsWithLocalOps( *localLogTail, false ); // don't allow unlocking or conversion to db backed storage } @@ -1086,7 +1086,8 @@ namespace mongo { } } - bool ReplSource::updateSetsWithLocalOps( OpTime &localLogTail, bool mayUnlock ) { + int ReplSource::updateSetsWithLocalOps( OpTime &localLogTail, bool mayUnlock ) { + int ret = 0; Client::Context ctx( "local.oplog.$main" ); auto_ptr< Cursor > localLog = findTableScan( "local.oplog.$main", BSON( "$natural" << -1 ) ); OpTime newTail; @@ -1098,6 +1099,7 @@ namespace mongo { } if ( !( localLogTail < ts ) ) break; + ++ret; updateSetsWithOp( op, mayUnlock ); if ( mayUnlock ) { RARELY { @@ -1114,7 +1116,7 @@ namespace mongo { } if ( !newTail.isNull() ) localLogTail = newTail; - return true; + return ret; } /* slave: pull some data from the master's oplog diff --git a/db/repl.h b/db/repl.h index eb1cb26c045..9dd9f72faac 100644 --- a/db/repl.h +++ b/db/repl.h @@ -130,8 +130,7 @@ namespace mongo { // call without the db mutex void resetSlave(); // call with the db mutex - // returns false if the slave has been reset - bool updateSetsWithLocalOps( OpTime &localLogTail, bool mayUnlock ); + int updateSetsWithLocalOps( OpTime &localLogTail, bool mayUnlock ); string ns() const { return string( "local.oplog.$" ) + sourceName(); } unsigned _sleepAdviceTime; |