During compaction (and cleanup by extension), it should be considered an error when EmuBinary returns (0, 0) for the a1 and a2 positions respectively, because this can mean any of the following invalid conditions:
1. The compaction token is not valid for the current field being compacted (i.e. a corrupted ECOC token was sent in the request).
2. All of the ESC entries for the current value+contention pair have been deleted.
3. An ECOC document exists for the current field, but with a value that is not authentic.
Cases 2 & 3 can only happen if there is a corruption of the QE state collections that has already occurred prior to the compaction operation. Case 1 can occur any time a client sends invalid compaction tokens in a compactStructuredEncryptionData command.
Since the compaction algorithm may delete from the ESC regardless of whether something was compacted, this destructive part of the algorithm should never be executed if any of the above 3 cases is possible. Therefore, the entire compaction operation MUST abort if any call to EmuBinary returns (0,0).