Skip to content

Commit 30149a4

Browse files
committed
on a missing object, thats ok as a delete may occur later
Conflicts: db/repl/rs_sync.cpp
1 parent 7db36ba commit 30149a4

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

db/oplog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ namespace mongo {
546546
RARELY ensureHaveIdIndex(ns); // otherwise updates will be super slow
547547
OpDebug debug;
548548
BSONObj updateCriteria = op.getObjectField("o2");
549-
bool upsert = fields[3].booleanSafe();
549+
bool upsert = op.getBoolField("b");
550550
UpdateResult ur = updateObjects(ns, o, updateCriteria, upsert, /*multi*/ false, /*logop*/ false , debug );
551551
if( ur.num == 0 ) {
552552
if( ur.mod ) {

db/repl/rs_sync.cpp

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ namespace mongo {
3636
*/
3737
bool ReplSetImpl::syncApply(const BSONObj &o) {
3838
const char *ns = o.getStringField("ns");
39-
nsToDatabase(ns, db);
40-
4139
if ( *ns == '.' || *ns == 0 ) {
4240
blank(o);
4341
return false;
@@ -157,20 +155,25 @@ namespace mongo {
157155
log() << "replSet assertion fetching missing object" << endl;
158156
throw;
159157
}
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;
168161
}
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+
}
174177
}
175178
}
176179
}

0 commit comments

Comments
 (0)