38 #include "mongo/base/disallow_copying.h" 39 #include "mongo/base/status.h" 42 #include "mongo/db/index/index_access_method.h" 43 #include "mongo/db/record_id.h" 47 class BackgroundOperation;
50 class OperationContext;
144 Status insert(
const BSONObj& wholeDocument,
const RecordId& loc)
override;
169 void commit(stdx::function<
void(
const BSONObj& spec)> onCreateFn)
override;
196 std::unique_ptr<IndexCatalogImpl::IndexBuildBlock>
block;
198 IndexAccessMethod*
real = NULL;
200 std::unique_ptr<IndexAccessMethod::BulkBuilder>
bulk;
const MatchExpression * filterExpression
Definition: index_create_impl.h:199
void allowBackgroundBuilding() override
By default we ignore the 'background' flag in specs when building an index.
Definition: index_create_impl.h:81
void commit(stdx::function< void(const BSONObj &spec)> onCreateFn) override
Marks the index ready for use.
Definition: index_create_impl.cpp:509
Status doneInserting(std::set< RecordId > *dupsOut=nullptr) override
Call this after the last insert().
Definition: index_create_impl.cpp:484
bool getBuildInBackground() const override
Definition: index_create_impl.h:187
~MultiIndexBlockImpl() override
Definition: index_create_impl.cpp:140
InsertDeleteOptions options
Definition: index_create_impl.h:202
void abortWithoutCleanup() override
May be called at any time after construction but before a successful commit().
Definition: index_create_impl.cpp:504
Copyright (C) 2014 MongoDB Inc.
Definition: bson_collection_catalog_entry.cpp:38
OperationContext * _opCtx
Definition: index_create_impl.h:213
bool _buildInBackground
Definition: index_create_impl.h:215
Collection *const collection
Definition: collection_info_cache_impl.cpp:53
OperationContext Database StringData BSONObj CollectionOptions::ParseKind bool const BSONObj &idIndex Status
Definition: database_impl.cpp:956
std::vector< IndexToBuild > _indexes
Definition: index_create_impl.h:207
StatusWith< std::vector< BSONObj > > init(const std::vector< BSONObj > &specs) override
Prepares the index(es) for building and returns the canonicalized form of the requested index specifi...
Definition: index_create_impl.cpp:207
void allowInterruption() override
Call this before init() to allow the index build to be interrupted.
Definition: index_create_impl.h:89
this is NOT safe through a yield right now.
Definition: collection.h:160
void ignoreUniqueConstraint() override
By default we enforce the 'unique' flag in specs when building an index by failing.
Definition: index_create_impl.h:100
Definition: index_create.h:63
Status insert(const BSONObj &wholeDocument, const RecordId &loc) override
Call this after init() for each document in the collection.
Definition: index_create_impl.cpp:464
Definition: index_key_validate.h:40
Builds one or more indexes.
Definition: index_create_impl.h:63
IndexAccessMethod * real
Definition: index_create_impl.h:198
bool _allowInterruption
Definition: index_create_impl.h:216
MultiIndexBlockImpl(OperationContext *opCtx, Collection *collection)
Neither pointer is owned.
Definition: index_create_impl.cpp:132
std::unique_ptr< IndexAccessMethod::BulkBuilder > bulk
Definition: index_create_impl.h:200
Collection * _collection
Definition: index_create_impl.h:212
std::unique_ptr< BackgroundOperation > _backgroundOperation
Definition: index_create_impl.h:209
On rollback sets MultiIndexBlockImpl::_needToCleanup to true.
Definition: index_create_impl.cpp:101
MONGO_DISALLOW_COPYING(MultiIndexBlockImpl)
void removeExistingIndexes(std::vector< BSONObj > *specs) const override
Removes pre-existing indexes from 'specs'.
Definition: index_create_impl.cpp:190
virtual bool initBackgroundIndexFromSpec(const BSONObj &spec) const =0
Definition: index_create_impl.h:195
std::unique_ptr< IndexCatalogImpl::IndexBuildBlock > block
Definition: index_create_impl.h:196
On rollback in init(), cleans up _indexes so that ~MultiIndexBlock doesn't try to clean up _indexes m...
Definition: index_create_impl.cpp:119
Collection *const OperationContext *const opCtx
Definition: collection_impl.cpp:80
bool _ignoreUnique
Definition: index_create_impl.h:217
Status insertAllDocumentsInCollection(std::set< RecordId > *dupsOut=nullptr) override
Inserts all documents in the Collection into the indexes and logs with timing info.
Definition: index_create_impl.cpp:322
bool _needToCleanup
Definition: index_create_impl.h:219