summaryrefslogtreecommitdiff
path: root/src/mongo/db/index_rebuilder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/index_rebuilder.cpp')
-rw-r--r--src/mongo/db/index_rebuilder.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mongo/db/index_rebuilder.cpp b/src/mongo/db/index_rebuilder.cpp
index 35969190807..fddb9f59ccb 100644
--- a/src/mongo/db/index_rebuilder.cpp
+++ b/src/mongo/db/index_rebuilder.cpp
@@ -30,12 +30,13 @@
#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/auth/user_name.h"
+#include "mongo/db/catalog/collection.h"
#include "mongo/db/catalog/database.h"
#include "mongo/db/client.h"
#include "mongo/db/instance.h"
#include "mongo/db/pdfile.h"
#include "mongo/db/repl/rs.h"
-#include "mongo/db/catalog/collection.h"
+#include "mongo/db/storage/mmap_v1/dur_transaction.h"
#include "mongo/util/scopeguard.h"
namespace mongo {
@@ -89,6 +90,8 @@ namespace mongo {
// This write lock is held throughout the index building process
// for this namespace.
Client::WriteContext ctx(ns);
+ DurTransaction txn; // XXX???
+
Collection* collection = ctx.ctx().db()->getCollection( ns );
if ( collection == NULL )
continue;
@@ -97,11 +100,11 @@ namespace mongo {
if ( collection->ns().isOplog() && indexCatalog->numIndexesTotal() > 0 ) {
warning() << ns << " had illegal indexes, removing";
- indexCatalog->dropAllIndexes( true );
+ indexCatalog->dropAllIndexes(&txn, true);
continue;
}
- vector<BSONObj> indexesToBuild = indexCatalog->getAndClearUnfinishedIndexes();
+ vector<BSONObj> indexesToBuild = indexCatalog->getAndClearUnfinishedIndexes(&txn);
// The indexes have now been removed from system.indexes, so the only record is
// in-memory. If there is a journal commit between now and when insert() rewrites
@@ -132,7 +135,7 @@ namespace mongo {
log() << "going to rebuild: " << indexObj;
- Status status = indexCatalog->createIndex( indexObj, false );
+ Status status = indexCatalog->createIndex(&txn, indexObj, false);
if ( !status.isOK() ) {
log() << "building index failed: " << status.toString() << " index: " << indexObj;
}