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

GlobalIndexesCache should use a StringMap rather than a StringDataMap

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Fully Compatible
    • ALL
    • Sharding EMEA 2022-10-03
    • 155

      StringData is a wrapper around a string, and the underlying string must stay alive while the StringData wrapper does. There are two problems with the current code.

      Because the IndexCatalogType is being passed by const reference to the GlobalIndexCache add function, the object is not staying alive when added to the map from the shard server op observer. However, fixing this will not solve the issue.

      In the GlobalIndexesCache, the underlying string is in the map value, but when the StringDataMap is dynamically resized, this will move the underlying data, leaving the StringData (key) referencing a freed location.

      We should just change this map to be a StringMap, which will create a copy of the string to be used as the key into the map.

            Assignee:
            allison.easton@mongodb.com Allison Easton
            Reporter:
            allison.easton@mongodb.com Allison Easton
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: