This adds a number of additional features to the repair process so it can actually fully recover if all data is present. Also added a several tests to ensure that the functionality works in multiple scenarios. This fixes #5987