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

Lock-free reads can leave CollectionCatalog stashed

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 6.0.0-rc0
    • None
    • None
    • None
    • Fully Compatible
    • ALL
    • Execution Team 2021-11-01, Execution Team 2021-11-15, Execution Team 2021-12-13, Execution Team 2022-02-07, Execution Team 2022-02-21, Execution Team 2022-03-07
    • 15

    Description

      If the root LFR operation is on a non-existing Collection it will not stash the CollectionCatalog onto the OperationContext

      If there is a nested LFR operation under a Lock-free read that did not stash the CollectionCatalog the nested operation will instead do the stashing: https://github.com/mongodb/mongo/blob/45bc7a2c06d788a2fddc8601450d4a1fb8dbf489/src/mongo/db/db_raii.cpp#L142

      When the nested LFR lock helper is destroyed the CollectionCatalog will not be unstashed because only the root LFR helper may unstash: https://github.com/mongodb/mongo/blob/45bc7a2c06d788a2fddc8601450d4a1fb8dbf489/src/mongo/db/catalog/collection_catalog.cpp#L1163-L1167

      But the root LFR lock helper will not unstash either because it never stashed anything: https://github.com/mongodb/mongo/blob/45bc7a2c06d788a2fddc8601450d4a1fb8dbf489/src/mongo/db/catalog/collection_catalog.cpp#L1178

      This can cause logic that runs after an operation, like the profile operation, to use this stashed CollectionCatalog. If the system.profile collection is missing that would result in the profile operation not being able to see the collection that was just created: https://github.com/mongodb/mongo/blob/45bc7a2c06d788a2fddc8601450d4a1fb8dbf489/src/mongo/db/introspect.cpp#L142-L144

      This can happen on a secondary if the system.profile collection is removed concurrently.

      Attachments

        Activity

          People

            henrik.edin@mongodb.com Henrik Edin
            henrik.edin@mongodb.com Henrik Edin
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: