diff options
Diffstat (limited to 'src/mongo/db/catalog/index_catalog.cpp')
-rw-r--r-- | src/mongo/db/catalog/index_catalog.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mongo/db/catalog/index_catalog.cpp b/src/mongo/db/catalog/index_catalog.cpp index 8662eb0f906..b572a66426e 100644 --- a/src/mongo/db/catalog/index_catalog.cpp +++ b/src/mongo/db/catalog/index_catalog.cpp @@ -365,6 +365,11 @@ Status IndexCatalog::IndexBuildBlock::init() { const bool initFromDisk = false; _entry = _catalog->_setupInMemoryStructures(_txn, descriptorCleaner.release(), initFromDisk); + // Register this index with the CollectionInfoCache to regenerate the cache. This way, updates + // occurring while an index is being build in the background will be aware of whether or not + // they need to modify any indexes. + _collection->infoCache()->addedIndex(_txn, descriptor); + return Status::OK(); } @@ -413,8 +418,6 @@ void IndexCatalog::IndexBuildBlock::success() { }); entry->setIsReady(true); - - collection->infoCache()->addedIndex(_txn, desc); } namespace { |