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

Add support for a shared-mutex type

    • Service Arch

      We are having new use-cases that could benefit from a shared-mutex type. Examples include but are not limited to:

      • SERVER-57811: uses a custom SpinLock implementation to swap the storage engine.
      • SERVER-51055: introduced SyncUnique to avoid data-races while setting/getting ServiceContext fields (e.g., fastClockSource).

      The absence of a shared-mutex type leaves developers with no option other than introducing new, case-specific shared-mutex-like types.

      The desired interface is very similar to std::shared_mutex, but the implementation should address the following:

      • The shared path must be very fast, and almost impose no cost.
      • Both exclusive and shared accesses must be interruptible (e.g., by accepting a object that implements the Interruptible interface).
      • Often, it is okay to delay the exclusive path in favor of the shared path. This should be considered in implementing the shared-mutex type.

      The aim of this ticket is to:

      • Identify the shared-mutex implementation that fits the above considerations/requirements.
      • Wrap the implementation inside a Mongo library under stdx namespace.
      • File tickets to replace existing code that is no longer relevant with the introduction of the new shared-mutex type.

            Assignee:
            backlog-server-servicearch [DO NOT USE] Backlog - Service Architecture
            Reporter:
            amirsaman.memaripour@mongodb.com Amirsaman Memaripour
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: