0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

repair handles invalid objects better

This commit is contained in:
Eliot Horowitz 2011-03-06 21:43:54 -05:00
parent 382d7e21d3
commit 28683f8464

View File

@ -185,8 +185,26 @@ public:
}
log(1) << loc << endl;
Record* rec = loc.rec();
log(1) << loc.obj() << endl;
w( loc.obj() );
BSONObj obj;
try {
obj = loc.obj();
assert( obj.valid() );
LOG(1) << obj << endl;
w( obj );
}
catch ( std::exception& e ) {
log() << "found invalid document @ " << loc << " " << e.what() << endl;
if ( ! obj.isEmpty() ) {
try {
BSONElement e = obj.firstElement();
stringstream ss;
ss << "first element: " << e;
log() << ss.str();
}
catch ( std::exception& ee ) {
}
}
}
loc = forward ? rec->getNext( loc ) : rec->getPrev( loc );
}
return forward ? e->xnext : e->xprev;