[SERVER-69936] GlobalIndexesCache should use a StringMap rather than a StringDataMap Created: 23/Sep/22  Updated: 29/Oct/23  Resolved: 27/Sep/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.2.0-rc0

Type: Bug Priority: Major - P3
Reporter: Allison Easton Assignee: Allison Easton
Resolution: Fixed Votes: 0
Labels: PM-2583-Milestone-1
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding EMEA 2022-10-03
Participants:
Linked BF Score: 155

 Description   

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.



 Comments   
Comment by Githook User [ 27/Sep/22 ]

Author:

{'name': 'Allison Easton', 'email': 'allison.easton@mongodb.com', 'username': 'allisoneaston'}

Message: SERVER-69936 GlobalIndexesCache should use a StringMap rather than a StringDataMap
Branch: master
https://github.com/mongodb/mongo/commit/4ef16e59e45b6777a8a5b829881676a55e6d4000

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