summaryrefslogtreecommitdiff
path: root/src/mongo/tools/dump.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/tools/dump.cpp')
-rw-r--r--src/mongo/tools/dump.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mongo/tools/dump.cpp b/src/mongo/tools/dump.cpp
index a7672e0b722..f699e76585e 100644
--- a/src/mongo/tools/dump.cpp
+++ b/src/mongo/tools/dump.cpp
@@ -41,6 +41,7 @@
#include "mongo/db/catalog/database_catalog_entry.h"
#include "mongo/db/db.h"
#include "mongo/db/namespace_string.h"
+#include "mongo/db/operation_context_impl.h"
#include "mongo/db/catalog/collection.h"
#include "mongo/tools/mongodump_options.h"
#include "mongo/tools/tool.h"
@@ -252,7 +253,7 @@ public:
int repair() {
toolInfoLog() << "going to try and recover data from: " << toolGlobalParams.db << std::endl;
- return _repair(toolGlobalParams.db);
+ return _repairByName(toolGlobalParams.db);
}
void _repairExtents(Collection* coll, Writer& writer) {
@@ -330,9 +331,11 @@ public:
<< std::endl;
}
- int _repair( string dbname ) {
- Client::WriteContext cx( dbname );
- Database * db = cx.ctx().db();
+ int _repairByName(string dbname) {
+ OperationContextImpl txn;
+ Client::WriteContext cx(&txn, dbname);
+
+ Database* db = dbHolderUnchecked().get(dbname, storageGlobalParams.dbpath);
list<string> namespaces;
db->getDatabaseCatalogEntry()->getCollectionNamespaces( &namespaces );