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

Prevent MODE_X and MODE_S locks from being yielded and reacquired

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 6.0 Required
    • Component/s: Concurrency
    • Labels:
      None
    • Linked BF Score:
      161

      Description

      Callers typically acquire a MODE_X lock to exclude all readers and writers and a MODE_S lock to exclude all writers. Allowing query yielding, hybrid index building, etc. to release and later reacquire these locks can invalidate assumptions about what these internal callers thought acquiring a strong lock meant within the system because it enables other readers and writers to act on the collection.

      We should consider making it a programmer error to use Locker::saveLockStateAndUnlock() and/or Locker::restoreLockState() to yield and reacquire MODE_X and MODE_S locks, or consider making it a programmer error to use PlanYieldPolicy::YieldPolicy::YIELD_AUTO while holding a MODE_X or MODE_S lock. Note: The caller could instead set PlanYieldPolicy::YieldPolicy::NO_YIELD or similar with an intent lock to reflect their intention to not see the effects of other writers if they actually wanted the effects of what yielding and reacquiring strong locks would imply for some reason.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-server-execution Backlog - Storage Execution Team
              Reporter:
              max.hirschhorn Max Hirschhorn
              Participants:
              Votes:
              1 Vote for this issue
              Watchers:
              12 Start watching this issue

                Dates

                Created:
                Updated: