diff options
Diffstat (limited to 'src/mongo/db/catalog/index_create.cpp')
-rw-r--r-- | src/mongo/db/catalog/index_create.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mongo/db/catalog/index_create.cpp b/src/mongo/db/catalog/index_create.cpp index 7f27589085d..8549b4f8b0c 100644 --- a/src/mongo/db/catalog/index_create.cpp +++ b/src/mongo/db/catalog/index_create.cpp @@ -147,12 +147,12 @@ void MultiIndexBlock::removeExistingIndexes(std::vector<BSONObj>* specs) const { } } -Status MultiIndexBlock::init(const BSONObj& spec) { +StatusWith<std::vector<BSONObj>> MultiIndexBlock::init(const BSONObj& spec) { const auto indexes = std::vector<BSONObj>(1, spec); return init(indexes); } -Status MultiIndexBlock::init(const std::vector<BSONObj>& indexSpecs) { +StatusWith<std::vector<BSONObj>> MultiIndexBlock::init(const std::vector<BSONObj>& indexSpecs) { WriteUnitOfWork wunit(_txn); invariant(_indexes.empty()); @@ -182,6 +182,9 @@ Status MultiIndexBlock::init(const std::vector<BSONObj>& indexSpecs) { _buildInBackground = (_buildInBackground && info["background"].trueValue()); } + std::vector<BSONObj> indexInfoObjs; + indexInfoObjs.reserve(indexSpecs.size()); + for (size_t i = 0; i < indexSpecs.size(); i++) { BSONObj info = indexSpecs[i]; StatusWith<BSONObj> statusWithInfo = @@ -190,6 +193,7 @@ Status MultiIndexBlock::init(const std::vector<BSONObj>& indexSpecs) { if (!status.isOK()) return status; info = statusWithInfo.getValue(); + indexInfoObjs.push_back(info); IndexToBuild index; index.block.reset(new IndexCatalog::IndexBuildBlock(_txn, _collection, info)); @@ -241,7 +245,7 @@ Status MultiIndexBlock::init(const std::vector<BSONObj>& indexSpecs) { } } - return Status::OK(); + return indexInfoObjs; } Status MultiIndexBlock::insertAllDocumentsInCollection(std::set<RecordId>* dupsOut) { |