Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

on a missing object, thats ok as a delete may occur later

Conflicts:

	db/repl/rs_sync.cpp
  • Loading branch information...
commit 30149a4335fd08bb62287dd1b0fbd2bf7b8bfe62 1 parent 7db36ba
Kristina kchodorow authored

Showing 2 changed files with 19 additions and 16 deletions. Show diff stats Hide diff stats

  1. +1 1  db/oplog.cpp
  2. +18 15 db/repl/rs_sync.cpp
2  db/oplog.cpp
@@ -546,7 +546,7 @@ namespace mongo {
546 546 RARELY ensureHaveIdIndex(ns); // otherwise updates will be super slow
547 547 OpDebug debug;
548 548 BSONObj updateCriteria = op.getObjectField("o2");
549   - bool upsert = fields[3].booleanSafe();
  549 + bool upsert = op.getBoolField("b");
550 550 UpdateResult ur = updateObjects(ns, o, updateCriteria, upsert, /*multi*/ false, /*logop*/ false , debug );
551 551 if( ur.num == 0 ) {
552 552 if( ur.mod ) {
33 db/repl/rs_sync.cpp
@@ -36,8 +36,6 @@ namespace mongo {
36 36 */
37 37 bool ReplSetImpl::syncApply(const BSONObj &o) {
38 38 const char *ns = o.getStringField("ns");
39   - nsToDatabase(ns, db);
40   -
41 39 if ( *ns == '.' || *ns == 0 ) {
42 40 blank(o);
43 41 return false;
@@ -157,20 +155,25 @@ namespace mongo {
157 155 log() << "replSet assertion fetching missing object" << endl;
158 156 throw;
159 157 }
160   - assert( !missingObj.isEmpty() );
161   - Client::Context ctx(ns);
162   - try {
163   - DiskLoc d = theDataFileMgr.insert(ns, (void*) missingObj.objdata(), missingObj.objsize());
164   - assert( !d.isNull() );
165   - } catch(...) {
166   - log() << "replSet assertion during insert of missing object" << endl;
167   - throw;
  158 + if( missingObj.isEmpty() ) {
  159 + log() << "replSet missing object not found on source. presumably deleted later in oplog" << endl;
  160 + log() << "replSet op: " << o.toString() << endl;
168 161 }
169   - // now reapply the update from above
170   - bool failed = syncApply(o);
171   - if( failed ) {
172   - log() << "replSet update still fails after adding missing object " << ns << endl;
173   - assert(false);
  162 + else {
  163 + Client::Context ctx(ns);
  164 + try {
  165 + DiskLoc d = theDataFileMgr.insert(ns, (void*) missingObj.objdata(), missingObj.objsize());
  166 + assert( !d.isNull() );
  167 + } catch(...) {
  168 + log() << "replSet assertion during insert of missing object" << endl;
  169 + throw;
  170 + }
  171 + // now reapply the update from above
  172 + bool failed = syncApply(o);
  173 + if( failed ) {
  174 + log() << "replSet update still fails after adding missing object " << ns << endl;
  175 + assert(false);
  176 + }
174 177 }
175 178 }
176 179 }

0 comments on commit 30149a4

Please sign in to comment.
Something went wrong with that request. Please try again.