Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-29374

Remove massert check on numIndexesInProgress() from IndexCatalog::dropAllIndexes()

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.3.1
    • Affects Version/s: None
    • Component/s: Storage
    • Labels:
    • Fully Compatible
    • Execution Team 2019-09-09

      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
      void IndexCatalogImpl::dropAllIndexes(OperationContext* opCtx,
                                            bool includingIdIndex,
                                            std::map<std::string, BSONObj>* droppedIndexes) {
          invariant(opCtx->lockState()->isCollectionLockedForMode(_collection->ns().toString(), MODE_X));
      
          BackgroundOperation::assertNoBgOpInProgForNs(_collection->ns().ns());
      
          // there may be pointers pointing at keys in the btree(s).  kill them.
          // TODO: can this can only clear cursors on this index?
          _collection->getCursorManager()->invalidateAll(
              opCtx, false, "all indexes on collection dropped");
      
          // make sure nothing in progress
          massert(17348,
                  "cannot dropAllIndexes when index builds in progress",
                  numIndexesTotal(opCtx) == numIndexesReady(opCtx));
      

            Assignee:
            haley.connelly@mongodb.com Haley Connelly
            Reporter:
            benety.goh@mongodb.com Benety Goh
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: