summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristina <kristina@10gen.com>2011-10-05 14:43:10 -0400
committerKristina <kristina@10gen.com>2011-10-05 14:43:10 -0400
commit30149a4335fd08bb62287dd1b0fbd2bf7b8bfe62 (patch)
tree2094c66fd1650f42030033f8934783130ca9ef2d
parent7db36ba5a388d1f8f55cd4c5a7ce9c8fb7e82d7d (diff)
downloadmongo-30149a4335fd08bb62287dd1b0fbd2bf7b8bfe62.tar.gz
on a missing object, thats ok as a delete may occur later
Conflicts: db/repl/rs_sync.cpp
-rw-r--r--db/oplog.cpp2
-rw-r--r--db/repl/rs_sync.cpp33
2 files changed, 19 insertions, 16 deletions
diff --git a/db/oplog.cpp b/db/oplog.cpp
index 0eacb677087..e248d5e11ec 100644
--- a/db/oplog.cpp
+++ b/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 ) {
diff --git a/db/repl/rs_sync.cpp b/db/repl/rs_sync.cpp
index d09509fb5b2..7f8522de44b 100644
--- a/db/repl/rs_sync.cpp
+++ b/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);
+ }
}
}
}