[SERVER-54988] Improper use of map::operator[] Created: 05/Mar/21  Updated: 29/Oct/23  Resolved: 06/Mar/21

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

Type: Bug Priority: Major - P3
Reporter: Daniel Gottlieb (Inactive) Assignee: Daniel Gottlieb (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding 2021-03-08
Participants:
Linked BF Score: 58

 Description   

A pin lookup for a request uses operator[] which, as we all know, instantiates a default constructed version of the value type. A successful pin isn't bothered by this default construction (the default constructed value will be overwritten), but a failing pin should leave the key/value non-existent (if that was the pre-state). Failure to do so makes it seem as if there's a pin request when there is none.



 Comments   
Comment by Githook User [ 06/Mar/21 ]

Author:

{'name': 'Daniel Gottlieb', 'email': 'daniel.gottlieb@mongodb.com', 'username': 'dgottlieb'}

Message: SERVER-54988: Replace map::operator[] with map::find.
Branch: master
https://github.com/mongodb/mongo/commit/2e705aefaeffc4221bb920ad5275ece140a68569

Generated at Thu Feb 08 05:35:08 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.