private void loadEntriesFromNextIndexSegment() {
      currentIndexSegmentStartOffset = currentIndexSegmentStartOffset == null ? indexSegmentsByOffset.firstKey()
          : indexSegmentsByOffset.higherKey(currentIndexSegmentStartOffset);
      IndexSegment indexSegment = indexSegmentsByOffset.get(currentIndexSegmentStartOffset);
      List<IndexEntry> indexEntries = new ArrayList<>();
      try {
        indexSegment.getIndexEntriesSince(null, new FindEntriesCondition(Long.MAX_VALUE), indexEntries,
            new AtomicLong(0), true, false);
        // for each index entry, if it represents a squashed put entry, add an index entry to account for that.
        List<IndexEntry> entriesToAdd = new ArrayList<>();
        for (IndexEntry indexEntry : indexEntries) {
          IndexValue value = indexEntry.getValue();
          long origMsgOffset = value.getOriginalMessageOffset();
          if (value.isFlagSet(IndexValue.Flags.Delete_Index)
              && origMsgOffset != IndexValue.UNKNOWN_ORIGINAL_MESSAGE_OFFSET
              && origMsgOffset >= indexSegment.getStartOffset().getOffset()) {
            try (BlobReadOptions options = index.getBlobReadInfo(indexEntry.getKey(),
                EnumSet.allOf(StoreGetOptions.class))) {
              Offset putOffset = new Offset(indexSegment.getLogSegmentName(), options.getOffset());
              IndexValue putValue = new IndexValue(options.getMessageInfo().getSize(), putOffset,
                  options.getMessageInfo().getExpirationTimeInMs(), value.getOperationTimeInMs(), value.getAccountId(),
                  value.getContainerId());
              entriesToAdd.add(new IndexEntry(indexEntry.getKey(), putValue));
            }
          }
        }
        indexEntries.addAll(entriesToAdd);
        Collections.sort(indexEntries, PersistentIndex.INDEX_ENTRIES_OFFSET_COMPARATOR);
        LOGGER.info("Loaded entries from {}", indexSegment.getFile());
      } catch (StoreException e) {
        throw new IllegalStateException(e);
      }
      indexEntriesIterator = indexEntries.iterator();
    }
Loads entries from the next index segment.
ambry-tools/src/main/java/com/github/ambry/store/CompactionVerifier.java