Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-10590

Issues with repairDatabase documentation



    • Bug
    • Status: Closed
    • Critical - P2
    • Resolution: Fixed
    • None
    • None
    • manual
    • None
    • true


      There are several issues with the repairDatabase documentation page in https://docs.mongodb.com/manual/reference/command/repairDatabase/

      repairDatabase is an administrative command that needs to be run with due care, especially in a replica set configuration. However, the tone and content of the documentation page gives the impression that this is a "safe" command to run. As a result, the suggestion to run repairDatabase for the smallest of issues is often see in community advice.

      In MMAPv1, repairDatabase rebuilds the data files based on the data that can be successfully read. Running this command in a replica set could potentially create inconsistencies in the set. Since all nodes in a replica set are assumed to contain identical data, this will lead to difficult to diagnose crashes and other surprising behaviour.

      Confirmation will be needed as to what exactly repairDatabase does for WiredTiger.

      A sample of incorrect and misleading statements in the page are:

      1. The repairDatabase command compacts all collections in the database. It is identical to running the compact command on each collection individually. This statement is very, very false and misleading. repairDatabase is not identical to bulk-compact.
      2. repairDatabase reduces the total size of the data files on disk Reducing data size is not the goal of repairDatabase
      3. However, if you trust that there is no corruption and you have enough free space, then repairDatabase is the appropriate and the only way to reclaim disk space. This statement is misleading. Reclaiming space should never be the goal of doing a repairDatabase.

      The result of running repairDatabase may be irreversible. Hence, this command should come with:

      1. Encouragement to take a file copy backup of the dbpath before attempting any repair operations
      2. Information on what this command does for each storage engine
      3. Big warnings against running this in a replica set.
      4. Big warnings that you should not treat this command lightly, since the consequences of this command may be irreversible, lost data, etc.
      5. Big warnings that this command is a last resort.


        Issue Links



              kay.kim@mongodb.com Kay Kim (Inactive)
              kevin.adistambha@mongodb.com Kevin Adistambha
              Jonathan Dahl Jonathan Dahl
              0 Vote for this issue
              4 Start watching this issue


                4 years, 50 weeks, 4 days ago