[SERVER-23996] ShardRegistry::getShard should return a StatusWith<shared_ptr<Shard>> Created: 29/Apr/16  Updated: 02/Sep/16  Resolved: 25/Aug/16

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

Type: Task Priority: Major - P3
Reporter: Spencer Brody (Inactive) Assignee: Misha Tyulenev
Resolution: Done Votes: 0
Labels: PM550
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Duplicate
is duplicated by SERVER-21527 Race between remove shard and access ... Closed
is duplicated by SERVER-23739 NULL pointer dereference in PublicGri... Closed
Backwards Compatibility: Fully Compatible
Sprint: Sharding 2016-08-29
Participants:
Linked BF Score: 0

 Description   

Currently every place that calls ShardRegistry::getShard has to check to make sure the pointer it gets back isn't null, and if it is it usually then constructs a Status with the ShardNotFound code to report that. It would be clearer and less error prone if we just returned a StatusWith, making the fact that getShard can fail to actually get a shard explicit, and less likely that a caller forgets to check and accidentally dereferences a null pointer.



 Comments   
Comment by Githook User [ 25/Aug/16 ]

Author:

{u'username': u'mikety', u'name': u'Misha Tyulenev', u'email': u'misha@mongodb.com'}

Message: SERVER-23996 ShardRegistry::getShard should return a StatusWith<shared_ptr<Shard>>
Branch: master
https://github.com/mongodb/mongo/commit/46b33e042de75d801e5fd9f20b74a1c9a249b0c2

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