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

Make recovery from query yield interruptible

    XMLWordPrintable

    Details

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

      Description

      PROBLEM
      The server query yielding mechanism uses the saveLockStateAndUnlock/restoreLockState combination of calls in order to get the lock state free all its acquired locks and then re-acquire them.

      The re-acquisition of the locks currently must run with UninterruptibleLockGuard because otherwise the interruption exception will unwind to the lock manager's RAII classes destructors and they will try to unlock an already unlocked resource id.

      Not being able to interrupt the restoreLockState call though is problematic because it can lead to deadlocks, which would otherwise get resolved automatically.

      PROPOSED SOLUTION
      I propose making restoreLockState interruptible by introducing an internal variable on the Locker, called boost::optional<LockSnapshot> _yieldedLocks and making saveLockStateAndUnlock place the locks it yielded inside this variable instead of returning them as an output parameter.

      restoreLockState will use the values in _yieldedLocks to reacquire the locks back and if it gets interrupted, the Locker::unlock calls can check if a lock was yielded inside the _yieldedLocks list.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kaloian.manassiev Kaloian Manassiev
              Reporter:
              kaloian.manassiev Kaloian Manassiev
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: