summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog
diff options
context:
space:
mode:
authorScott Hernandez <scotthernandez@tart.local>2016-05-27 10:19:47 -0400
committerScott Hernandez <scotthernandez@tart.local>2016-06-17 11:53:01 -0400
commite88fe869359348c1f8c6bc1dfd134ac6489eb51b (patch)
tree1a6589b909187d965e496a5bf47de3e57d811231 /src/mongo/db/catalog
parent39b48364619c56154148111414101db5bd1e1a8b (diff)
downloadmongo-e88fe869359348c1f8c6bc1dfd134ac6489eb51b.tar.gz
SERVER-23750: remove init impl from header and add invariant checks
Diffstat (limited to 'src/mongo/db/catalog')
-rw-r--r--src/mongo/db/catalog/index_create.cpp10
-rw-r--r--src/mongo/db/catalog/index_create.h4
2 files changed, 10 insertions, 4 deletions
diff --git a/src/mongo/db/catalog/index_create.cpp b/src/mongo/db/catalog/index_create.cpp
index 2abcaf2c00e..fa206180e5f 100644
--- a/src/mongo/db/catalog/index_create.cpp
+++ b/src/mongo/db/catalog/index_create.cpp
@@ -143,6 +143,11 @@ void MultiIndexBlock::removeExistingIndexes(std::vector<BSONObj>* specs) const {
}
}
+Status MultiIndexBlock::init(const BSONObj& spec) {
+ const auto indexes = std::vector<BSONObj>(1, spec);
+ return init(indexes);
+}
+
Status MultiIndexBlock::init(const std::vector<BSONObj>& indexSpecs) {
WriteUnitOfWork wunit(_txn);
@@ -151,7 +156,10 @@ Status MultiIndexBlock::init(const std::vector<BSONObj>& indexSpecs) {
const string& ns = _collection->ns().ns();
- Status status = _collection->getIndexCatalog()->checkUnfinished();
+ const auto idxCat = _collection->getIndexCatalog();
+ invariant(idxCat);
+ invariant(idxCat->ok());
+ Status status = idxCat->checkUnfinished();
if (!status.isOK())
return status;
diff --git a/src/mongo/db/catalog/index_create.h b/src/mongo/db/catalog/index_create.h
index 084149529f1..e5f18a42ed3 100644
--- a/src/mongo/db/catalog/index_create.h
+++ b/src/mongo/db/catalog/index_create.h
@@ -113,9 +113,7 @@ public:
* Requires holding an exclusive database lock.
*/
Status init(const std::vector<BSONObj>& specs);
- Status init(const BSONObj& spec) {
- return init(std::vector<BSONObj>(1, spec));
- }
+ Status init(const BSONObj& spec);
/**
* Inserts all documents in the Collection into the indexes and logs with timing info.