|
The existing repairDatabasesAndCheckVersion is always called at startup. This means that it doesn't always "repair" except when MongoDB is started with --repair. It is also 250 lines long and reaches a nesting depth of 6 in multiple places.
We could improve this by separating it into its components, which would each be called separately in db.cpp.
- Create two different helpers, repairAllDatabases and checkAllDatabases
- Call repairAllDatabases if --repair was provided
- Next, call checkAllDatabases, which should be refactored to its components (in this order):
- Checking data files
- Rebuilding unfinished indexes
- Checking FCV version and non-local databases
|