After the first phase of validation detects potential errors, we will log a message informing users that the second phase of the validation is going to be run.
The second phase of validation will consist of tracking all the KeyStrings that were hashed to erroneous buckets during the first phase. We will keep track of the document keys KeyString of the erroneous buckets and only remove them once a corresponding KeyString from an index entry is seen.
This allows us to see which document keys are missing index entries and which index entries are missing document keys once the second phase is finished going through the data.
We'll limit reporting the number of errors to be the maximum size of a document. The KeyStrings will have to be transformed back into BSON format with appropriate messages entailing what went wrong with them.