diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-08-16 17:07:08 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-08-16 17:07:08 -0400 |
commit | 3770916e055c5760c7410bc580ca3ce1e8c8f9f2 (patch) | |
tree | 6ec366803a3e207103f6b844c7d46c400aaed97e | |
parent | 67159d2583670da3b299a29d6e96e1afd119d31e (diff) | |
download | mongo-3770916e055c5760c7410bc580ca3ce1e8c8f9f2.tar.gz |
SERVER-1626 initial sync bug fix
Conflicts:
db/repl.cpp
-rw-r--r-- | db/repl.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/db/repl.cpp b/db/repl.cpp index cf7fea84293..37197bab81c 100644 --- a/db/repl.cpp +++ b/db/repl.cpp @@ -860,12 +860,11 @@ namespace mongo { void ReplSource::sync_pullOpLog_applyOperation(BSONObj& op, OpTime *localLogTail) { if( logLevel >= 6 ) // op.tostring is expensive so doing this check explicitly log(6) << "processing op: " << op << endl; + // skip no-op + if( op.getStringField("op")[0] == 'n' ) + return; - /* the no-op makes us process queued up databases. so returning here would be problematic */ -//// if ( op.getStringField( "op" )[ 0 ] == 'n' ) -//// return; - char clientName[MaxDatabaseLen]; const char *ns = op.getStringField("ns"); nsToDatabase(ns, clientName); @@ -1306,12 +1305,15 @@ namespace mongo { 1) find most recent op in local log 2) more()? */ - if ( !oplogReader.more() ) { + + bool moreInitialSyncsPending = !addDbNextPass.empty() && n; // we need "&& n" to assure we actually process at least one op to get a sync point recorded in the first place. + + if ( moreInitialSyncsPending || !oplogReader.more() ) { dblock lk; OpTime nextLastSaved = nextLastSavedLocalTs(); { dbtemprelease t; - if ( oplogReader.more() ) { + if ( !moreInitialSyncsPending && oplogReader.more() ) { if ( getInitialSyncCompleted() ) { // if initial sync hasn't completed, break out of loop so we can set to completed or clone more dbs continue; } @@ -1328,6 +1330,8 @@ namespace mongo { log() << "repl: end sync_pullOpLog syncedTo: " << syncedTo.toStringLong() << endl; break; } + else { + } OCCASIONALLY if( n > 0 && ( n > 100000 || time(0) - saveLast > 60 ) ) { // periodically note our progress, in case we are doing a lot of work and crash |