[SERVER-38870] IndexCatalogImpl::createIndexOnEmptyCollection() doesn't roll back properly Created: 07/Jan/19  Updated: 27/Oct/23  Resolved: 17/Apr/20

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

Type: Bug Priority: Major - P3
Reporter: Gregory Wlodarek Assignee: Maria van Keulen
Resolution: Gone away Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-38797 Add unit tests for the IndexCatalog Closed
Operating System: ALL
Sprint: Execution Team 2020-04-20, Execution Team 2020-05-04
Participants:

 Description   

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



 Comments   
Comment by Maria van Keulen [ 17/Apr/20 ]

I added code similar to the pseudocode under a failpoint and did not reproduce the failure. gregory.wlodarek also wrote a unit test similar to the pseudocode, which passes, so it seems like this is no longer an issue. Per a discussion with Gregory, the issue in this ticket most likely came from a unit test that wasn't committed. I don't think it's necessary to add a regression test for the issue at this time, so I'm closing this ticket as Gone Away.

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