[SERVER-29374] Remove massert check on numIndexesInProgress() from IndexCatalog::dropAllIndexes() Created: 25/May/17  Updated: 30/Oct/23  Resolved: 03/Sep/19

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: 4.3.1

Type: Improvement Priority: Major - P3
Reporter: Benety Goh Assignee: Haley Connelly
Resolution: Fixed Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-29274 Two Phase Drops: rename collection to... Closed
Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2019-09-09
Participants:

 Description   

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));



 Comments   
Comment by Githook User [ 03/Sep/19 ]

Author:

{'username': 'haleyConnelly', 'email': 'haley.connelly@10gen.com', 'name': 'Haley Connelly'}

Message: SERVER-29374 Remove massert check on numIndexesInProgress() from IndexCatalog::dropAllIndexes()
Branch: master
https://github.com/mongodb/mongo/commit/e924930b6dd631ef3335d5eb901237fd0dec22af

Comment by Sara Williamson [ 24/Jun/19 ]

Discussed in backlog grooming – we now believe this is fine to remove.

Comment by Geert Bosch [ 01/Jun/17 ]

This check has caught problems in the past. We need to ensure similar checks are elsewhere that would catch regressions.

Comment by Benety Goh [ 25/May/17 ]

This issue came up during the work on SERVER-29274 where we were refactoring Database::dropCollection() which calls IndexCatalog::dropAllIndexes().

The changes done in SERVER-29274 involved reproducing some of the checks in IndexCatalog::dropAllIndexes().

Generated at Thu Feb 08 04:20:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.