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

OperationShardVersion::get should return a pointer, not a mutable reference

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Sharding
    • None
    • Sharding EMEA

      OperationShardVersion is a copyable type, and OperationShardVersion::get(txn) returns a reference to "txn"'s OSV. If that value is captured into a local value variable instead of a local reference variable by omitting the &, the compiler will not fail, and this could lead to hard to find bugs.

      OperationShardVersion::get should be changed to return a pointer, and its value should be captured into an OperationShardVersion* when it is captured at all, to avoid this risk.

            Assignee:
            backlog-server-sharding-emea [DO NOT USE] Backlog - Sharding EMEA
            Reporter:
            schwerin@mongodb.com Andy Schwerin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: