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

opCtx is a naked pointer, except where it's a std::unique_ptr<>.

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Won't Fix
    • Affects Version/s: 3.5.9
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Throughout the server, OperationContexts are operated on via a naked pointer always named opCtx. Often there is a stdx::unique_ptr<OperationContext> (typedef'd "UniqueOperationContext") also named opCtx. There is no way to protect against a null opCtx, or any of myriad implicit, incorrect pointer operations.

      • OperationContext should be renamed OperationContext::Impl.
      • OperationContext itself should be a struct wrapping a std::unique_ptr<OperationContext::Impl>.
      • Uses of OperationContext* in interfaces should be replaced with an OpCtxRef, wrapping a guaranteed non-null OperationContext::Impl*.
      • Member functions of the present OperationContext should be moved to OpCtxRef or to Impl, according to usage.

        Attachments

          Activity

            People

            Assignee:
            backlog-server-platform DO NOT USE - Backlog - Platform Team
            Reporter:
            nathan.myers Nathan Myers
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: