Skip to content
Browse files

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

Conflicts:

	db/repl/rs_sync.cpp
  • Loading branch information...
1 parent 7db36ba commit 30149a4335fd08bb62287dd1b0fbd2bf7b8bfe62 @kchodorow kchodorow committed Oct 5, 2011
Showing with 19 additions and 16 deletions.
  1. +1 −1 db/oplog.cpp
  2. +18 −15 db/repl/rs_sync.cpp
View
2 db/oplog.cpp
@@ -546,7 +546,7 @@ namespace mongo {
RARELY ensureHaveIdIndex(ns); // otherwise updates will be super slow
OpDebug debug;
BSONObj updateCriteria = op.getObjectField("o2");
- bool upsert = fields[3].booleanSafe();
+ bool upsert = op.getBoolField("b");
UpdateResult ur = updateObjects(ns, o, updateCriteria, upsert, /*multi*/ false, /*logop*/ false , debug );
if( ur.num == 0 ) {
if( ur.mod ) {
View
33 db/repl/rs_sync.cpp
@@ -36,8 +36,6 @@ namespace mongo {
*/
bool ReplSetImpl::syncApply(const BSONObj &o) {
const char *ns = o.getStringField("ns");
- nsToDatabase(ns, db);
-
if ( *ns == '.' || *ns == 0 ) {
blank(o);
return false;
@@ -157,20 +155,25 @@ namespace mongo {
log() << "replSet assertion fetching missing object" << endl;
throw;
}
- assert( !missingObj.isEmpty() );
- Client::Context ctx(ns);
- try {
- DiskLoc d = theDataFileMgr.insert(ns, (void*) missingObj.objdata(), missingObj.objsize());
- assert( !d.isNull() );
- } catch(...) {
- log() << "replSet assertion during insert of missing object" << endl;
- throw;
+ if( missingObj.isEmpty() ) {
+ log() << "replSet missing object not found on source. presumably deleted later in oplog" << endl;
+ log() << "replSet op: " << o.toString() << endl;
}
- // now reapply the update from above
- bool failed = syncApply(o);
- if( failed ) {
- log() << "replSet update still fails after adding missing object " << ns << endl;
- assert(false);
+ else {
+ Client::Context ctx(ns);
+ try {
+ DiskLoc d = theDataFileMgr.insert(ns, (void*) missingObj.objdata(), missingObj.objsize());
+ assert( !d.isNull() );
+ } catch(...) {
+ log() << "replSet assertion during insert of missing object" << endl;
+ throw;
+ }
+ // now reapply the update from above
+ bool failed = syncApply(o);
+ if( failed ) {
+ log() << "replSet update still fails after adding missing object " << ns << endl;
+ assert(false);
+ }
}
}
}

0 comments on commit 30149a4

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