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

Remove lock from ShardSplitDonorService::checkIfOptionsConflict

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.1.0-rc0
    • Affects Version/s: 6.1.0-rc0
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Server Serverless 2022-08-08
    • 145

      Remove the lock from ShardSplitDonorService::DonorStateMachine::checkIfOptionsConflict. Create const member fields like tenant_migration_donor_service (https://github.com/10gen/mongo/blob/103cf67c1488288beb7d8bd68f3550a612d6d054/src/mongo/db/repl/tenant_migration_donor_service.h#L288-L296) so lock is not needed to check options.

      Change is aimed to avoid deadlock when:

      (1) Instance lock is held in ShardSplitDonorService::DonorStateMachine::run (https://github.com/10gen/mongo/blob/9743d69c7dbc92fd5abcf9c799daff89e30ca233/src/mongo/db/serverless/shard_split_donor_service.cpp#L335)

      (2) POS lock is held ShardSplitDonorService::getOrCreateInstance (https://github.com/10gen/mongo/blob/9743d69c7dbc92fd5abcf9c799daff89e30ca233/src/mongo/db/repl/primary_only_service.cpp#L543)

      (3) getOrCreateInstance -> ShardSplitDonorService::DonorStateMachine::checkIfOptionsConflict waits on instance lock (https://github.com/10gen/mongo/blob/9743d69c7dbc92fd5abcf9c799daff89e30ca233/src/mongo/db/serverless/shard_split_donor_service.cpp#L295) 

      (2) onCreateOperationContext -> ShardSplitDonorService::registerOpCtx waits on POS lock (https://github.com/10gen/mongo/blob/9743d69c7dbc92fd5abcf9c799daff89e30ca233/src/mongo/db/repl/primary_only_service.cpp#L261). 

            Assignee:
            didier.nadeau@mongodb.com Didier Nadeau
            Reporter:
            alex.li@mongodb.com Alex Li
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: