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

ShardRegistry::getShard should return a StatusWith<shared_ptr<Shard>>

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.3.12
    • Affects Version/s: None
    • Component/s: Sharding
    • Fully Compatible
    • Sharding 2016-08-29
    • 0

      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.

            Assignee:
            misha.tyulenev@mongodb.com Misha Tyulenev (Inactive)
            Reporter:
            spencer@mongodb.com Spencer Brody (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: