private void verifyRecord(String errMsgId, IndexEntry srcEntry, IndexEntriesIterator tgtEntriesIterator,
      boolean verifyLogData) throws IOException {
    assert tgtEntriesIterator.hasNext() : "There are no more entries in the target index";
    IndexEntry tgtEntry = tgtEntriesIterator.next();

    IndexValue srcValue = srcEntry.getValue();
    IndexValue tgtValue = tgtEntry.getValue();

    assert srcEntry.getKey().equals(tgtEntry.getKey()) :
        errMsgId + ": Key mismatch: old - " + srcEntry.getKey() + ", new - " + tgtEntry.getKey();
    assert
        srcValue.getFlags() == tgtValue.getFlags() :
        errMsgId + ": Flags mismatch: old - " + srcValue.getFlags() + ", new - " + tgtValue.getFlags();
    assert
        srcValue.getSize() == tgtValue.getSize() :
        errMsgId + ": Size mismatch: old - " + srcValue.getSize() + ", new - " + tgtValue.getSize();
    assert Utils.getTimeInMsToTheNearestSec(srcValue.getExpiresAtMs()) == Utils.getTimeInMsToTheNearestSec(
        tgtValue.getExpiresAtMs()) :
        errMsgId + ": ExpiresAt mismatch: old - " + srcValue.getExpiresAtMs() + ", new - " + tgtValue.getExpiresAtMs();
    assert
        srcValue.getAccountId() == tgtValue.getAccountId() :
        errMsgId + ": AccountId ID mismatch: old - " + srcValue.getAccountId() + ", new - " + tgtValue.getAccountId();
    assert
        srcValue.getContainerId() == tgtValue.getContainerId() :
        errMsgId + ": Container ID mismatch: old - " + srcValue.getContainerId() + ", new - "
            + tgtValue.getContainerId();
    if (verifyLogData) {
      LogSegment srcLogSegment = srcLog.getSegment(srcValue.getOffset().getName());
      LogSegment tgtLogSegment = tgtLog.getSegment(tgtValue.getOffset().getName());
      byte[] srcBlob = getDataFromLogSegment(srcLogSegment, srcValue.getOffset().getOffset(), srcValue.getSize());
      byte[] tgtBlob = getDataFromLogSegment(tgtLogSegment, tgtValue.getOffset().getOffset(), tgtValue.getSize());
      for (int i = 0; i < srcBlob.length; i++) {
        assert srcBlob[i] == tgtBlob[i] : errMsgId + " Data does not match at index: " + i;
      }
    }
  }
Verifies that:
1. Index entry metadata in the source == Index entry metadata in the target
2. Log data in the source == Log data in the target.
@param errMsgId an unique identifier that will be printed with error messages to help debugging.
@param srcEntry the {@link IndexEntry} in the source store.
@param tgtEntriesIterator the {@link Iterator} for index entries in the target index.
@param verifyLogData {@code true} if the data in the log needs to be verified. {@code false} otherwise.
@throws IOException if there is any I/O error reading from the log/index.
ambry-tools/src/main/java/com/github/ambry/store/CompactionVerifier.java