Permalink
Browse files

fix initial sync when primary is busy with new network thread

  • Loading branch information...
1 parent 1151331 commit 7033636a9fad0228b0d645d689dbc8682ff566d4 @erh erh committed Jul 16, 2012
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/mongo/db/repl/rs_initialsync.cpp
@@ -374,6 +374,16 @@ namespace mongo {
}
lastOp = minValid;
+ // its currently important that lastOp is equal to the last op we actually pulled
+ // this is because the background thread only pulls each op once now
+ // so if its now, we'll be waiting forever
+ {
+ // this takes whatever the last op the we got is
+ // and stores it locally before we wipe it out below
+ Lock::DBRead lk(rsoplog);
+ Helpers::getLast(rsoplog, lastOp);
+ lastOp = lastOp.getOwned();
+ }
// reset state, as that "didn't count"
emptyOplog();

0 comments on commit 7033636

Please sign in to comment.