-
Type: New Feature
-
Resolution: Won't Do
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: mongorestore
-
Not Needed
-
-
(copied to CRM)
mongorestore currently restores indexes with their original options as recorded by mongodump. If an index was originally created with background:true it will be built in the background, but the default behaviour is to build indexes in the foreground which is a blocking operation. When restoring data into a production environment, foreground index builds can cause unexpected outages.
A default behaviour with less surprise would be to force all indexes to be built in the background regardless of the original background value. A parameter like --allowForegroundIndexBuilds could be added to speed up the builds if the user is aware of the caveats.
Two limited workarounds I've seen used:
- update the *.metadata.json files in the dump directory to add background:true if not present
- use mongorestore's --noIndexRestore option to avoid accidentally building any indexes in the foreground, and then create the indexes with background:true after mongorestore finishes restoring the data. This requires knowledge of the indexes & options that need to be recreated, which may again be found by parsing mongodump's *.metadata.json files if there is no easier source available.
- related to
-
TOOLS-1385 Mongorestore should allow doing all index builds only at the end
- Closed
-
SERVER-20960 Default index build option support in config/runtime
- Closed
-
TOOLS-639 Benchmark non-blocking index builds in mongorestore
- Closed