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

IndexCatalogImpl::createIndexOnEmptyCollection() doesn't roll back properly

    • Type: Icon: Bug Bug
    • Resolution: Gone away
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Storage
    • ALL
    • Execution Team 2020-04-20, Execution Team 2020-05-04

      If we call createIndexOnEmptyCollection() and roll back by not committing the WriteUnitOfWork that it was called in, then the second time we try to call this function, we hit an invariant:

      Invariant failure findRecord(opCtx, loc, &data) Didn't find RecordId RecordId(2) in record store _mdb_catalog
      

      The following pseudocode can be used to reproduce this:

      {
          WriteUnitOfWork wuow();
          collection->getIndexCatalog()->createIndexOnEmptyCollection();
          // WriteUnitOfWork is rolled back after leaving this scope.
      }
      
      WriteUnitOfWork wuow();
      collection->getIndexCatalog()->createIndexOnEmptyCollection(); // above invariant hit.
      wuow.commit(); // unreachable
      

            Assignee:
            maria.vankeulen@mongodb.com Maria van Keulen
            Reporter:
            gregory.wlodarek@mongodb.com Gregory Wlodarek
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: