Permalink
Browse files

continuation of initial sync fix

Conflicts:

	db/repl/rs_sync.cpp
  • Loading branch information...
1 parent 2e48cfb commit 7db36ba5a388d1f8f55cd4c5a7ce9c8fb7e82d7d @kchodorow kchodorow committed Oct 5, 2011
Showing with 18 additions and 6 deletions.
  1. +18 −6 db/repl/rs_sync.cpp
View
@@ -147,13 +147,25 @@ namespace mongo {
return false;
}
const char *ns = o.getStringField("ns");
- BSONObj query = BSONObjBuilder().append(o.getObjectField("o2")[_id]).obj(); // might be more than just _id in the update criteria
- BSONObj missingObj = missingObjReader.findOne(
- ns,
- query );
+ BSONObj query = BSONObjBuilder().append(o.getObjectField("o2")["_id"]).obj(); // might be more than just _id in the update criteria
+ BSONObj missingObj;
+ try {
+ missingObj = missingObjReader.findOne(
+ ns,
+ query );
+ } catch(...) {
+ log() << "replSet assertion fetching missing object" << endl;
+ throw;
+ }
assert( !missingObj.isEmpty() );
- DiskLoc d = theDataFileMgr.insert(ns, (void*) missingObj.objdata(), missingObj.objsize());
- assert( !d.isNull() );
+ 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 ) {

0 comments on commit 7db36ba

Please sign in to comment.