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

Disallow dropping collections under config/admin via mongos

    XMLWordPrintable

    Details

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

      See the linked BF.

      Show
      See the linked BF.
    • Sprint:
      Sharding 2020-04-20
    • Linked BF Score:
      45

      Description

      This ticket makes it such that attempting to drop collections under the admin or config database through mongos will now throw an error. Attempting to call dropDatabase on admin or config will similarly throw an error. It is still possible to drop these collections when connecting directly to the config server.

      Original Description:

      _configsvrDropCollection calls lockWithSessionID() which sets the readSource to be kMajorityCommitted and all the following commands from _configsvrDropCollection would erroneously keep using kMajorityCommitted as the readSource.

      Here is what happened in BF-9590:
      1. The config primary server got _configsvrDropCollection command.
      2. The distributed lock manager ran lockWithSessionID which triggered a majority read, so the readSource of the WiredTigerRecoveryUnit was set to 'majority'.
      3. There was another thread which just finished adding an index to the collection "admin.mod1"
      4. _configsvrDropCollection finally called dropCollection which did a check whether the numbers of indexes on disk and in memory were equal. Since the readSource was still "majority", we read the on-disk catalog with "majority" timestamp when the change to index catalog was not made yet. But the in-memory index catalog has the new index.

      Update:
      _configsvrDropCollection() finally called dropCollection() because the collection is in admin database whose primary shard is the config server itself.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              renctan Randolph Tan
              Reporter:
              xiangyu.yao Xiangyu Yao (Inactive)
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: