summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2011-03-06 21:43:54 -0500
committerEliot Horowitz <eliot@10gen.com>2011-03-06 21:43:54 -0500
commit28683f84647f088ecbcc4d6fec23f46b3be19193 (patch)
tree7b338ac733e3b6aeec52f8ba9bb8d034fa347cc6 /tools
parent382d7e21d3842bee948466914d16d28289823592 (diff)
downloadmongo-28683f84647f088ecbcc4d6fec23f46b3be19193.tar.gz
repair handles invalid objects better
Diffstat (limited to 'tools')
-rw-r--r--tools/dump.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/tools/dump.cpp b/tools/dump.cpp
index c919f31cab4..1e696edf3a0 100644
--- a/tools/dump.cpp
+++ b/tools/dump.cpp
@@ -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;