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

Repair should handle duplicate unique index keys

    XMLWordPrintable

    Details

    • Backwards Compatibility:
      Fully Compatible
    • Backport Requested:
      v4.4, v4.2
    • Sprint:
      Execution Team 2020-07-13, Execution Team 2020-07-27

      Description

      Starting mongod with --repair first salvages collections in WiredTiger and then rebuilds all indexes. The salvage operation can recover multiple versions of the same document, so it's possible for a collection to end up with duplicate _id keys. This causes the repair operation to fail, and it becomes impossible to start MongoDB to recover any data.

      If an index rebuild fails, we should drop the index and continue. This can be paired with a warning message on startup if an _id index is missing on a collection.

      An alternative would be to provide a parameter "repairSkipIndexRebuild" that skips rebuilding all indexes. This easily has the potential to result in having corrupt indexes even if repair succeeds, whereas removing the index and forcing the user to rebuild prevents that problem entirely.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              fausto.leyva Fausto Leyva (Inactive)
              Reporter:
              louis.williams Louis Williams
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: