diff options
author | Hari Khalsa <hkhalsa@10gen.com> | 2014-04-30 16:24:00 -0400 |
---|---|---|
committer | Hari Khalsa <hkhalsa@10gen.com> | 2014-04-30 16:26:38 -0400 |
commit | 5fc98b83d4b68e87493bbe468f2da396b4576568 (patch) | |
tree | 81e99fdd56bc3f6c7c4a5338313256c293dcdf6d /src/mongo | |
parent | 22ac42b23ca0f9dd80a62091098b4477944bafcb (diff) | |
download | mongo-5fc98b83d4b68e87493bbe468f2da396b4576568.tar.gz |
SERVER-13643 have index builder use TransactionExperiment
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/db/index_builder.cpp | 10 | ||||
-rw-r--r-- | src/mongo/db/index_builder.h | 3 | ||||
-rw-r--r-- | src/mongo/db/repl/oplog.cpp | 2 |
3 files changed, 9 insertions, 6 deletions
diff --git a/src/mongo/db/index_builder.cpp b/src/mongo/db/index_builder.cpp index 0a0a808fd90..8f6ff9c6051 100644 --- a/src/mongo/db/index_builder.cpp +++ b/src/mongo/db/index_builder.cpp @@ -62,8 +62,9 @@ namespace mongo { cc().curop()->reset(HostAndPort(), dbInsert); NamespaceString ns(_index["ns"].String()); Client::WriteContext ctx(ns.getSystemIndexesCollection()); + DurTransaction txn; - Status status = build( ctx.ctx() ); + Status status = build(&txn, ctx.ctx()); if ( !status.isOK() ) { log() << "IndexBuilder could not build index: " << status.toString(); } @@ -71,7 +72,9 @@ namespace mongo { cc().shutdown(); } - Status IndexBuilder::build( Client::Context& context ) const { + Status IndexBuilder::build(TransactionExperiment* txn, + Client::Context& context ) const { + string ns = _index["ns"].String(); Database* db = context.db(); Collection* c = db->getCollection( ns ); @@ -83,8 +86,7 @@ namespace mongo { // Show which index we're building in the curop display. context.getClient()->curop()->setQuery(_index); - DurTransaction txn; // XXX - Status status = c->getIndexCatalog()->createIndex( &txn, + Status status = c->getIndexCatalog()->createIndex( txn, _index, true, IndexCatalog::SHUTDOWN_LEAVE_DIRTY ); diff --git a/src/mongo/db/index_builder.h b/src/mongo/db/index_builder.h index c3d042b5cea..a6705b0542f 100644 --- a/src/mongo/db/index_builder.h +++ b/src/mongo/db/index_builder.h @@ -41,6 +41,7 @@ namespace mongo { class Collection; + class TransactionExperiment; class IndexBuilder : public BackgroundJob { public: @@ -54,7 +55,7 @@ namespace mongo { */ virtual std::string name() const; - Status build( Client::Context& context ) const; + Status build(TransactionExperiment* txn, Client::Context& context ) const; /** * Kill all in-progress indexes matching criteria, if non-empty: diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp index 405b21c45aa..c45143687b7 100644 --- a/src/mongo/db/repl/oplog.cpp +++ b/src/mongo/db/repl/oplog.cpp @@ -554,7 +554,7 @@ namespace mongo { Client::Context* ctx = cc().getContext(); verify( ctx ); IndexBuilder builder(o); - Status status = builder.build( *ctx ); + Status status = builder.build(txn, *ctx); if ( status.isOK() ) { // yay } |