diff options
author | Aaron <aaron@10gen.com> | 2012-10-25 14:07:23 -0700 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2012-11-08 16:32:38 -0800 |
commit | 6a51b6b01e4ebdd723e6ad33f07934d5558f9ad7 (patch) | |
tree | 28bcdb963e99f213a281148a53b3c801c5fb41d8 /src/mongo/db/index.cpp | |
parent | f5d6b28def1f23def5cd1ba551f5dc73277407ff (diff) | |
download | mongo-6a51b6b01e4ebdd723e6ad33f07934d5558f9ad7.tar.gz |
SERVER-3067 Add killop support for foreground index builds.
Diffstat (limited to 'src/mongo/db/index.cpp')
-rw-r--r-- | src/mongo/db/index.cpp | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/src/mongo/db/index.cpp b/src/mongo/db/index.cpp index 62b95ec11a9..1925d2e5773 100644 --- a/src/mongo/db/index.cpp +++ b/src/mongo/db/index.cpp @@ -16,18 +16,20 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "mongo/pch.h" + +#include "mongo/db/index.h" + #include <boost/checked_delete.hpp> -#include "pch.h" -#include "namespace-inl.h" -#include "index.h" -#include "btree.h" -#include "background.h" -#include "repl/rs.h" -#include "ops/delete.h" +#include "mongo/db/background.h" +#include "mongo/db/btree.h" +#include "mongo/db/index_update.h" +#include "mongo/db/namespace-inl.h" +#include "mongo/db/ops/delete.h" +#include "mongo/db/repl/rs.h" #include "mongo/util/scopeguard.h" - namespace mongo { IndexInterface::IndexInserter::IndexInserter() {} @@ -282,21 +284,12 @@ namespace mongo { return true; } - /* Prepare to build an index. Does not actually build it (except for a special _id case). - - We validate that the params are good - - That the index does not already exist - - Creates the source collection if it DNE - - example of 'io': - { ns : 'test.foo', name : 'z', key : { z : 1 } } - - throws DBException - - @param sourceNS - source NS we are indexing - @param sourceCollection - its details ptr - @return true if ok to continue. when false we stop/fail silently (index already exists) - */ - bool prepareToBuildIndex(const BSONObj& io, bool god, string& sourceNS, NamespaceDetails *&sourceCollection, BSONObj& fixedIndexObject ) { + bool prepareToBuildIndex(const BSONObj& io, + bool mayInterrupt, + bool god, + string& sourceNS, + NamespaceDetails*& sourceCollection, + BSONObj& fixedIndexObject) { sourceCollection = 0; // logical name of the index. todo: get rid of the name, we don't need it! @@ -364,7 +357,7 @@ namespace mongo { */ if ( IndexDetails::isIdIndexPattern(key) ) { if( !god ) { - ensureHaveIdIndex( sourceNS.c_str() ); + ensureHaveIdIndex( sourceNS.c_str(), mayInterrupt ); return false; } } |