private List<File> getAllIndexSegmentFiles() throws StoreException {
    List<File> indexFiles = new ArrayList<>();
    LogSegment logSegment = log.getFirstSegment();
    while (logSegment != null) {
      File[] files = getIndexSegmentFilesForLogSegment(dataDir, logSegment.getName());
      if (files == null) {
        throw new StoreException("Could not read index files from directory [" + dataDir + "]",
            StoreErrorCodes.IndexCreationFailure);
      }
      indexFiles.addAll(Arrays.asList(files));
      logSegment = log.getNextSegment(logSegment);
    }
    Collections.sort(indexFiles, INDEX_SEGMENT_FILE_COMPARATOR);
    return indexFiles;
  }
Loads all index segment files that refer to segments in the log. The list of files returned are sorted by the
their start offsets using {@link #INDEX_SEGMENT_FILE_COMPARATOR}.
@return all index segment files that refer to segments in the log.
@throws StoreException if index segment files could not be listed from the directory.
ambry-store/src/main/java/com/github/ambry/store/PersistentIndex.java