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

ShardingRecoveryService should provide blocking acquire API

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 7.0.0-rc0
    • Component/s: None
    • None
    • Sharding EMEA
    • Sharding EMEA 2023-05-15
    • None
    • 0
    • None
    • None
    • None
    • None
    • None
    • None

      In the current ShardingRecoveryService API, acquireRecoverableCriticalSectionBlockWrites tasserts if the CS is held by some thread on the same namespace and expects the caller to check. This is problematic for two reasons:

      1. The caller only cares about acquiring CS and releasing it, it would need to know multiple additional APIs to check for others holding the CS.
      2. The semantics of acquire/release in critical section APIs is usually block until acquire succeeds. Between checking for CS in IS mode and acquiring, there is a race and theoretically there is a starvation problem.

      ShardingRecoveryService can be improved to provide additional APIs to block until acquire and consolidate waiting/signals. This would also prevent incorrect usage bugs and simplify code. Although DDL operations are serialized at ShardingDDLCoordinator, there are cases like these where acquiring CS can fail.

            Assignee:
            sergi.mateo-bellido@mongodb.com Sergi Mateo Bellido
            Reporter:
            abdul.qadeer@mongodb.com Abdul Qadeer
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: