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

Repair should handle duplicate unique index keys

    • Fully Compatible
    • v4.4, v4.2
    • Execution Team 2020-07-13, Execution Team 2020-07-27

      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.

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

              Created:
              Updated:
              Resolved: