private void compareReplicaIndexEntriestoLogContent(String replicaRootDirectory) throws Exception {
    if (!new File(replicaRootDirectory).exists()) {
      throw new IllegalArgumentException("Replica root directory does not exist " + replicaRootDirectory);
    }
    final Timer.Context context = metrics.compareReplicaIndexFilesToLogTimeMs.time();
    try {
      logger.info("Comparing Index entries to Log ");
      File[] indexFiles = new File(replicaRootDirectory).listFiles(PersistentIndex.INDEX_SEGMENT_FILE_FILTER);
      if (indexFiles == null || indexFiles.length == 0) {
        throw new IllegalStateException("No index files found in replica root directory " + replicaRootDirectory);
      }
      Arrays.sort(indexFiles, PersistentIndex.INDEX_SEGMENT_FILE_COMPARATOR);
      for (int i = 0; i < indexFiles.length; i++) {
        // check end offset if this is the last index segment
        boolean checkEndOffset = i == indexFiles.length - 1;
        if (!checkEndOffset) {
          // check end offset if the log segment represented by this index segment is different from the one represented
          // by the next one
          LogSegmentName currLogSegmentRef = IndexSegment.getIndexSegmentStartOffset(indexFiles[i].getName()).getName();
          LogSegmentName nextLogSegmentRef =
              IndexSegment.getIndexSegmentStartOffset(indexFiles[i + 1].getName()).getName();
          checkEndOffset = !currLogSegmentRef.equals(nextLogSegmentRef);
        }
        compareIndexEntriesToLogContent(indexFiles[i], checkEndOffset);
      }
    } finally {
      context.stop();
    }
  }
Compares every entry in every index file of a replica with those in the log.
Checks to see if each blob in index is successfully deserializable from the log
@param replicaRootDirectory the root directory of the replica
@throws Exception
ambry-tools/src/main/java/com/github/ambry/store/DumpDataTool.java