(document with discretion)
Starting mongod with --repair on a WiredTiger data directory now handles and recovers from the following scenarios:
- Corrupt .wt files (existing behavior)
- Collections are salvaged by discarding corrupt data
- Indexes are unconditionally rebuilt
- Missing .wt data files (for both collections and indexes)
SERVER-35627A new, empty .wt file is created
- Unsalvageable collection data files
SERVER-35782Repair moves aside unsalvageable data files and creates empty ones in their place
- Corrupt WiredTiger metadata files
SERVER-35629Salvage corrupt WiredTiger.wt/WiredTiger.turtle files by discarding corrupt data
- “Orphaned” data files
Additionally, --repair has the following new behavior:
SERVER-35731If a repair operation modifies data, the node will not be able to rejoin a replica set without a full resync
- Note: if a repair operation fails for any reason, the node will be unable to start up again without the --repair option.
SERVER-28990MongoDB will not bind to a port when started with --repair.
SERVER-36208The repairDatabase command has been removed in 4.1
The repair loop should be more forgiving about failures such as missing files and deal with collections or indexes missing from the catalog with a big warning message.
- In 4.0, separate out a bit more --repair/repairDatabase (i.e. don't single source as much) so that we can more easily port to 4.2