|
Currently, IndexCatalog::dropAllIndexes() does both a check on background operations on the collection and indexes that are still in the process of being built:
Since the only possible background operation is an index build, the check on the in-progress indexes may be redundant.
https://github.com/mongodb/mongo/blob/ff2cf3e560c4768f88c9911d09d8fa60526911dc/src/mongo/db/catalog/index_catalog_impl.cpp#L864
|
index_catalog_impl.cpp
|
851
|
void IndexCatalogImpl::dropAllIndexes(OperationContext* opCtx,
|
852
|
bool includingIdIndex,
|
853
|
std::map<std::string, BSONObj>* droppedIndexes) {
|
854
|
invariant(opCtx->lockState()->isCollectionLockedForMode(_collection->ns().toString(), MODE_X));
|
855
|
|
856
|
BackgroundOperation::assertNoBgOpInProgForNs(_collection->ns().ns());
|
857
|
|
858
|
// there may be pointers pointing at keys in the btree(s). kill them.
|
859
|
// TODO: can this can only clear cursors on this index?
|
860
|
_collection->getCursorManager()->invalidateAll(
|
861
|
opCtx, false, "all indexes on collection dropped");
|
862
|
|
863
|
// make sure nothing in progress
|
864
|
massert(17348,
|
865
|
"cannot dropAllIndexes when index builds in progress",
|
866
|
numIndexesTotal(opCtx) == numIndexesReady(opCtx));
|
|