Eng4981

Resolve an MP deadlock caused by a fundamental failure in the repair code.  All the meat is in the first 2 commits; the third is a refactoring (which has a corresponding small pro patch).  Everything else is additional logging or unit testing.  It's probably worth looking carefully at the last three commits just to be sure I didn't inject some condition that will crash or log copiously during normal operation.