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

Take distributed lock on database creation

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.1.2
    • Component/s: Sharding
    • Labels:
      None
    • Backwards Compatibility:
      Minor Change
    • Operating System:
      ALL

      Description

      There is a race condition if two different mongoses (or even two connections to the same mongos) try to create a database at the same time. Poor timing can make the mongos receive a "config write inconsistent" error when writing the config.databases entry where the insert is successful on 1 or more config servers but fails with a duplicate key error on 1 or more other config servers because the simultaneous db creation got there first.

      We didn't do this previously because of the way mongos was written wrt implicit database creation made it difficult to avoid taking the dist lock on every write event. With the new catalog refactor we've separated out implicit database creation so now it should be possible to take the distlock only when actually needed

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: