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

Database::_getOrCreateCollection() unregisters uuid catalog changes on WUOW rollback

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 3.5.11
    • None
    • Storage
    • None
    • Fully Compatible
    • ALL
    • Repl 2017-07-31
    • 0

    Description

      In Database::createCollection(), if we uassert on creating the _id index, the AddCollectionChange rollback logic will hit an invariant because the UUID for the collection is not removed from the UUIDCatalog.

      https://github.com/mongodb/mongo/blob/6cc2dfe7edd312b8596355edef454e15988e350e/src/mongo/db/catalog/database_impl.cpp#L752

      database_impl.cpp

      738
          opCtx->recoveryUnit()->registerChange(new AddCollectionChange(opCtx, this, ns));
      739
          Collection* collection = _getOrCreateCollectionInstance(opCtx, nss);
      740
          invariant(collection);
      741
          _collections[ns] = collection;
      742
       
      743
          BSONObj fullIdIndexSpec;
      744
       
      745
          if (createIdIndex) {
      746
              if (collection->requiresIdIndex()) {
      747
                  if (optionsWithUUID.autoIndexId == CollectionOptions::YES ||
      748
                      optionsWithUUID.autoIndexId == CollectionOptions::DEFAULT) {
      749
                      const auto featureCompatibilityVersion =
      750
                          serverGlobalParams.featureCompatibility.version.load();
      751
                      IndexCatalog* ic = collection->getIndexCatalog();
      752
                      fullIdIndexSpec = uassertStatusOK(ic->createIndexOnEmptyCollection(
      753
                          opCtx,
      754
                          !idIndex.isEmpty() ? idIndex
      755
                                             : ic->getDefaultIdIndexSpec(featureCompatibilityVersion)));
      756
                  }
      757
              }
      

      Attachments

        Activity

          People

            benety.goh@mongodb.com Benety Goh
            benety.goh@mongodb.com Benety Goh
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: